You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When serializing objects in .NET Framework using Newtonsoft JSON, the serializer includes the assembly name in the type name, which is mscorlib for .NET Framework. However, when deserializing in .NET Core, the expected assembly name is System.Private.CoreLib, not mscorlib. This discrepancy causes a TypeNameHandling bug where the deserializer cannot find the type because it’s looking in the wrong assembly. This issue arises because .NET Core and .NET Framework have different core libraries, leading to different type names.
Source/destination types
// Put the types you are serializing or deserializing here
When serializing objects in .NET Framework using Newtonsoft JSON, the serializer includes the assembly name in the type name, which is mscorlib for .NET Framework. However, when deserializing in .NET Core, the expected assembly name is System.Private.CoreLib, not mscorlib. This discrepancy causes a TypeNameHandling bug where the deserializer cannot find the type because it’s looking in the wrong assembly. This issue arises because .NET Core and .NET Framework have different core libraries, leading to different type names.
Source/destination types
// Put the types you are serializing or deserializing here
Source/destination JSON
{
"$type": "System.Object, mscorlib",
"Property1": "Value1",
"Property2": 123
}
Expected behavior
it should use TypeForwardedFrom attribute to handle this problem automatically without having to use jsonserializesettings
Actual behavior
throws exception because the assembly wasn't found.
Steps to reproduce
Deserialize the json in net.core
The text was updated successfully, but these errors were encountered: