Deserialization bugs in C# .NET 2.0 beta 2?

I upgraded from .net 2.0 beta 1 and when I tried to launch the app I was working on I get this error as it tried to deserialize it's settings

System.InvalidCastException occurred
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Runtime.Serialization.FormatterConverter.Convert(Object value, Type type)
at System.Runtime.Serialization.SerializationInfo.GetValue(String name, Type type)
at System.Collections.Generic.Dictionary`2.OnDeserialization(Object sender)
at System.Runtime.Serialization.DeserializationEventHandler.Invoke(Object sender)
at System.Runtime.Serialization.ObjectManager.RaiseDeserializationEvent()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at Tanjunka.UserSettings.Load() in D:\work\tanjunka\XMLRPCTest\UserSettings.cs:line 348

As far as I can tell the relavent part is Dictionary`2. All my types implement ISerializable except for a few Dictionarys like Dictionary<string,string> and Dictionary<string, MyTypeThatImplementsISerializable>

Stepping through the Deserializnig constructors it all my type are deserializing correctly. When it finally gets to the base types though it dies. Help! How do I fix this?

[1709 byte] By [greggman] at [2008-1-12]
# 1

Deserializing values between framework versions is probably not a wise idea due to things such as class member changes. A simply change such as a rename can cause a serialization exception to be thrown.

I suggest that you throw away the settings from Beta 1 and be prepared that it could occur also when moving from Beta 2 to to RTM.

DavidM.Kean at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Remoting and Runtime Serialization...
# 2
Greggman, unfortunately, we can't guarantee serialization compatibiltiy intra-version, since so many types change their internal structure and therefore, break the contract. Feel free to ping me directly (kitg@microsoft.com) if you have some data you want to try to rescue, but it's going to be circumspect to do so. If it's non-critical, it's simply a matter of upgrading to the Beta2 and throwing away the old data.

Regards,
Kit

KitG at 2007-8-21 > top of Msdn Tech,.NET Development,.NET Remoting and Runtime Serialization...

.NET Development

Site Classified