[Mono-dev] ObservableCollection and BindingList Serialization

Neale Ferguson NealeFerguson at verizon.net
Mon Mar 11 23:16:48 UTC 2013


Hi,
 ObservableCollection was moved from Windows.Base to System and
TypeForwardedTo and TypeForwardedFrom tags were added to the relevant source
code. ObservableCollection is serializable but when done on a Windows system
using .NET >= 3 the serialized object will still contain the WindowsBase,
Version=3.0.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35 data but
Mono will use System. Hence, if you serialize on Mono and then try and
deserialize on .NET then you get an error message:

Error when trying to deserialize with ObservableCollection: Unable to find
assembly 'System'.

Should the serializer use the forwarded information to ensure compatibility
with older programs (and with what .NET does)?

 In addition, Windows serializes a variable name _busyCount whereas Mono
defines _count.
 
 Also, I note that BindingList serialization on Mono has different and
missing variable names compared to the .NET equivalent. For example,
allow_new is allowNew in .NET. In addition, do those serialized variables
need to be public or should they be declared as private?

 A test case may be found at http://pastebin.com/sRFjhWka

Neale




More information about the Mono-devel-list mailing list