I am trying to migrate WPF application to .NET core . In my project serialization is used heavily. Below function work well on .NET 4.7 framework but after migrating to .NET core 3.1 gives error ' Serializing delegates is not supported on this platform' .
public static T Clone<T>(T source)
{
if (ReferenceEquals(source, null))
return default(T);
IFormatter formatter = new BinaryFormatter();
Stream stream = new MemoryStream();
using (stream)
{
// test
formatter.Serialize(stream, source);
stream.Seek(0, SeekOrigin.Begin);
return (T) formatter.Deserialize(stream);
}
}
I have changed serializable classes where ever => operator used or any property used delegates. After doing this part of code worked but some of module in project still throwing error - Serializing delegates is not supported on this platform.
Is there anyway to find which particular object or property is throwing this exception?
any hint or help appreciated. thanks.
Aucun commentaire:
Enregistrer un commentaire