Welcome to MSDN Blogs Sign in | Join | Help

Cross Version Serialization Broken between V1.1 and V2.0 [Ryan Byington]

In V2.0 we sometimes needed to add fields to types that existed in V1.1. If this type just has the Serializable attribute applied to it this will break serialization compatibility with V1.1. Currently when 1.1 tries to deserialize an instance with this new field it will throw an exception the runtime formatters do not allow for missing or additional fields.

 

We fixed this in V2.0 by adding the OptionalFieldAttribute which allows type authors to mark new fields as optional. This attribute would be applied to a field that was added in a newer version of the type. With this backwards and forwards serialization compatibility is maintained. 

 

However V1.1 and even V1.1 SP1 are still currently broken since the strict formatter behavior has not changed. This will likely be fixed in SP2 but until then don’t expect cross version serialization to work.

 

Some pretty fundamental types are affected by this like CompareInfo and any types like System.Collections.Comparer that have a field of this type. Which means Hashtable is broken as well.

Published Wednesday, March 16, 2005 12:39 PM by BCLTeam
Filed under:

Comments

Thursday, March 17, 2005 3:16 PM by David Boschmans' Weblog

# Tips

Tips
Friday, March 18, 2005 12:32 PM by Urs

# re: Cross Version Serialization Broken between V1.1 and V2.0 [Ryan Byington]

This was already an issue between V1.0 and V1.1 (e.g. with Hashtable), as I remember. I'm a bit disappointed it takes MSFT so long (until 1.1 SP2) to learn this lesson...
Monday, March 21, 2005 12:36 PM by Ido Samuelson

# Tips

Tips
Sunday, April 03, 2005 11:52 PM by 菊池 Blog

# .NET Framework V1.1でSerializeしたイメージはV2.0で読めない

.NET Framework V1.1でSerializeしたイメージはV2.0で読めない
New Comments to this post are disabled
 
Page view tracker