dotnet/Documentation/compatibility/netdatacontractserializer-f...

1.7 KiB

NetDataContractSerializer fails to deserialize a ConcurrentDictionary serialized with a different .NET version

Scope

Minor

Version Introduced

4.5.1

Source Analyzer Status

Planned

Change Description

By design, the xref:System.Runtime.Serialization.NetDataContractSerializer?displayProperty=name can be used only if both the serializing and deserializing ends share the same CLR types. Therefore, it is not guaranteed that an object serialized with one version of the .NET Framework can be deserialized by a different version.

xref:System.Collections.Concurrent.ConcurrentDictionary`2?displayProperty=name is a type that is known to not to deserialize correctly if serialized with the .NET Framework 4.5 or earlier and deserialized with the .NET Framework 4.5.1 or later.

  • Quirked
  • Build-time break

There are a number of possible work-arounds for this issue:

Affected APIs

  • M:System.Runtime.Serialization.NetDataContractSerializer.Deserialize(System.IO.Stream)

Category

Serialization

More information