Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Latest commit

 

History

History
31 lines (22 loc) · 1.49 KB

001 SoapFormatter cannot deserialize Hashtable and similar ordered collection objects.md

File metadata and controls

31 lines (22 loc) · 1.49 KB

1: SoapFormatter cannot deserialize Hashtable and similar ordered collection objects

Scope

Minor

Version Introduced

4.5

Source Analyzer Status

Available

Change Description

The SoapFormatter does not guarantee that objects serialized under one .NET Framework version will successfully deserialize under a different version. Specifically, some ordered collections (like Hashtable) added members between 4.0 and 4.5 such that objects of these types cannot deserialize with .NET 4.0 if they were serialized with .NET 4.5.
Note that if the serialized data is both serialized and deserialized with the same .NET Framework version, no issue will occur.

  • Quirked
  • Build-time break

Recommended Action

SoapFormatter serialization should be replaced with BinaryFormatter serialization or NetDataContractSerialization to be resilient to .NET Framework changes.

Affected APIs

  • M:System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Serialize(System.IO.Stream,System.Object)
  • M:System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Serialize(System.IO.Stream,System.Object,System.Runtime.Remoting.Messaging.Header[])
  • M:System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(System.IO.Stream)
  • M:System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(System.IO.Stream,System.Runtime.Remoting.Messaging.HeaderHandler)

Category

Serialization

More information