protected override XmlObjectSerializer CreateXmlObjectSerializer(Type type)
{
var serializerSettings = new DataContractSerializerSettings
{
KnownTypes = GetKnownTypes()
};
var serializer = new DataContractSerializer(type, serializerSettings);
serializer.SetSerializationSurrogateProvider(new ExpressionSurrogateProvider());
return serializer;
}
ISerializationSurrogateProvider allows to customize serialization and add support for unknown types.
PS. unfortunately, there is a bug in JSON serializer: dotnet/runtime#100553.
ISerializationSurrogateProviderallows to customize serialization and add support for unknown types.PS. unfortunately, there is a bug in JSON serializer: dotnet/runtime#100553.