Running on EpiSever.CMS 12.31.2
Recently we move the solution .net8 but facing issues when using the below code snippet:
var jsonSerializeSettings = new JsonSerializerOptions
{
WriteIndented = true,
ReferenceHandler = ReferenceHandler.IgnoreCycles,
};
string objSerializedString = JsonSerializer.Serialize(content, jsonSerializeSettings);
The exception, we are seeing:
Serialization and deserialization of 'System.Type' instances is not supported. Path: $.Property.PropertyValueType.
---> System.NotSupportedException: Serialization and deserialization of 'System.Type' instances is not supported.
---> System.NotSupportedException: Serialization and deserialization of 'System.Type' instances is not supported.
If we add a custom Converter to write down the assebly name, then we are seeing the exception:
Serialization and deserialization of 'System.Type' instances is not supported. Path: $.Property.PropertyValueType.
---> System.NotSupportedException: Serialization and deserialization of 'System.Type' instances is not supported.
---> System.NotSupportedException: Serialization and deserialization of 'System.Type' instances is not supported.
We attempted to use NewtonSoft.Json to serialize the object, but we found that performance degraded rapidly, and the server was unable to handle the requests after timing out.