Bug 9193 - XmlSerialization not properly deserializing a List
Summary: XmlSerialization not properly deserializing a List
Status: RESOLVED FIXED
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
URL:
Depends on:
Blocks:
 
Reported: 2013-01-02 12:58 UTC by Martin Bowling
Modified: 2013-01-09 10:41 UTC (History)
2 users (show)

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


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


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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!