Bug 9193 - XmlSerialization not properly deserializing a List
Summary: XmlSerialization not properly deserializing a List
Alias: None
Product: iOS
Classification: Xamarin
Component: General (show other bugs)
Version: 6.1.x
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Lluis Sanchez
Depends on:
Reported: 2013-01-02 12:58 UTC by Martin Bowling
Modified: 2013-01-09 10:41 UTC (History)
2 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:

Console Test Project to show the problem (44.56 KB, application/zip)
2013-01-02 12:58 UTC, Martin Bowling

Description Martin Bowling 2013-01-02 12:58:10 UTC
Created attachment 3154 [details]
Console Test Project to show the problem

I have included a sample project to show this bug, it runs fine on .NET and Mono runtimes on windows machine but on MonoTouch and Mono on Mac OS X, the xml is not properly deserialized. three items are expected but only one item is contained in the resulting object.
Comment 1 Miguel de Icaza [MSFT] 2013-01-08 17:51:57 UTC
Lluis, could you take a quick look at this one?
Comment 2 Lluis Sanchez 2013-01-09 05:47:37 UTC
It is a bug in the code that handles the ordering of elements. As a workaround, remove all the initialization of the Order property in the XmlElement attributes. For example, instead of:

[System.Xml.Serialization.XmlElementAttribute("Directory", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]

Change to:

[System.Xml.Serialization.XmlElementAttribute("Directory", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]

You have to remove them all.

I'm working on a fix.
Comment 3 Lluis Sanchez 2013-01-09 07:56:48 UTC
The bug has been fixed in master (d3fdb925ecab42de1caae607180e9ad928a1a907) and 2.10 branch (08021a9a73fd865a523f76a2c1b003072aaeb56f).
Comment 4 Miguel de Icaza [MSFT] 2013-01-09 10:27:07 UTC
Thank you Lluis!

We are bringing the fix to the both iOS and Android.
Comment 5 Martin Bowling 2013-01-09 10:41:25 UTC
Thanks for the quick fix guys!

Note You need to log in before you can comment on or make changes to this bug.