Bug 1820 - Deserialization issue from MonoTouch 4.0.7 to 4.2.2 when using Order
Summary: Deserialization issue from MonoTouch 4.0.7 to 4.2.2 when using Order
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: master
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-11-02 07:09 UTC by Chris Hardy [MSFT]
Modified: 2013-05-28 13:37 UTC (History)
4 users (show)

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


Attachments
An example of the issue (1.30 MB, application/zip)
2011-11-02 07:09 UTC, Chris Hardy [MSFT]
Details
smaller, console-based test case (3.98 KB, application/octet-stream)
2011-11-08 13:43 UTC, Sebastien Pouliot
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 GitHub or Developer Community 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 Chris Hardy [MSFT] 2011-11-02 07:09:33 UTC
Created attachment 806 [details]
An example of the issue

My app pulls data from a server and then deserializes into a set of objects.  These classes were auto-generated using Xsd2code, using an existing XSD schema.

This issue appears to be that any deserialization into generic Lists is only deserializing the first item from the XML.

For example, if I take the following fragment:
<Response>
<DataUpdates>
<DataUpdateInfo DataDate="2009-04-13T00:00:00" DataType="Data" LastUpdatedDate="2010-12-12T02:53:19.257" />
<DataUpdateInfo DataDate="2009-04-14T00:00:00" DataType="Data" LastUpdatedDate="2010-12-12T02:53:19.257" />
<DataUpdateInfo DataDate="2009-04-15T00:00:00" DataType="Data" LastUpdatedDate="2010-12-12T01:52:51.047" />
</DataUpdates>
</Response>

And deserialize using (in part) the following property:

[System.Xml.Serialization.XmlElementAttribute("DataUpdateInfo", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 0)]
public List<DataUpdatesDataUpdateInfo> DataUpdateInfo {
get { return this.dataUpdateInfoField; }
set { this.dataUpdateInfoField = value; }
}

I only get back the first item. This used to return all items in Monotouch 4.0.7.

However, if I remove the "Order = 0" property from the XmlElementAttribute declaration, all 3 items are deserialized correctly.


Could be linked to this change - https://github.com/mono/mono/commit/4fab2dc4c31a1161a90deb3003106bf3b81fab44
Comment 2 Sebastien Pouliot 2011-11-02 10:40:40 UTC
This works fine on 'master' so it's either a patch that has not been back ported to monotouch-4-2 or back ported after the 4.2.2 release.
Comment 3 Sebastien Pouliot 2011-11-02 11:38:19 UTC
I'll look if it was (or not) back ported to make sure it will be in 4.2.3 (when released)
Comment 4 Sebastien Pouliot 2011-11-02 13:09:24 UTC
I added a 
			Console.WriteLine (MonoTouch.Constants.Version);

to the sample and I got:

4.2.2
4/13/2009 12:00:00 AM
4/14/2009 12:00:00 AM
4/15/2009 12:00:00 AM
2011-11-02 13:04:21.287 test[32943:1107] Applications are expected to have a root view controller at the end of application launch


on my "Application Output". Of course my "4.2.2" is the top of the '4.2' branch (not the released 4.2.2 version) but if you (or Chris) can confirm that 4.2.2 prints a single DateTime line then I'll assume the fix is simply waiting for the next 4.2.x release.
Comment 5 Sebastien Pouliot 2011-11-08 13:28:22 UTC
The bug still exists (on 'master'). I uncommented the wrong line in the sample so I got the "right" result (default). However I hit the issue while constructing a regression test out of this :-(
Comment 6 Sebastien Pouliot 2011-11-08 13:43:57 UTC
Created attachment 848 [details]
smaller, console-based test case

mba:mono poupou$ mono --version
Mono JIT compiler version 2.10.6 (tarball Fri Sep 16 00:13:06 EDT 2011)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       normal
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          debugger softdebug 
	LLVM:          yes(2.9svn-mono)
	GC:            Included Boehm (with typed GC)
mba:mono poupou$ gmcs 1820.cs 
mba:mono poupou$ mono 1820.exe 
1


[opt/mono]mono --version
Mono JIT compiler version 2.11 (master/bd98012 Mon  7 Nov 2011 21:10:16 EST)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            Included Boehm (with typed GC)
[opt/mono]mono /Developer/MonoTouch/Source/mono/1820.exe 
1
Comment 7 Sebastien Pouliot 2013-05-28 13:37:47 UTC
This is fixed in Mono 3.0 (so 6.3.x releases works).
QA: test enabled on master-3.0