Bug 1636 - XmlSerialization exception in MT5.0 on device only with default AOT compiler
Summary: XmlSerialization exception in MT5.0 on device only with default AOT compiler
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 5.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Sebastien Pouliot
Depends on:
Reported: 2011-10-21 11:03 UTC by steve
Modified: 2012-01-16 11:20 UTC (History)
3 users (show)

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

Class marked serializable that causes serializer to fail (15.77 KB, application/octet-stream)
2011-10-21 11:03 UTC, steve

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:

Description steve 2011-10-21 11:03:10 UTC
Created attachment 751 [details]
Class marked serializable that causes serializer to fail

Description of Problem:

Attempt to xml serialize class (ExpenseData class code attached) in MonoTouch on device fails.  Works fine in simulator and when LLVM compile option used on device.
Set build to Link SDK assemblies only.

Steps to reproduce the problem:
1. attempt to create xmlserializer for ExpenseData class, e.g. XmlSerializer xs = new XmlSerializer(typeof(ExpenseData))


Actual Results:

Get *System.NullReference* exception in

Expected Results:

No exception, instance of XmlSerializer should be created for the type with no error.

How often does this happen? 

Always (certainly since iOS 5 / MT 5.0)

Additional Information:
Comment 1 Sebastien Pouliot 2011-10-21 11:22:36 UTC
-> monotouch

Comment 2 Sebastien Pouliot 2011-10-21 13:35:54 UTC
> Works fine in simulator and when LLVM compile option used on device.

from your original mail I understand it **fails** when used on device with LLVM, right ?
Comment 3 Sebastien Pouliot 2011-10-21 14:20:26 UTC
I cannot duplicate the issue. It's either because:

a) I had to remove a lot of code from your attachment to make it compile locally; or

b) the (not-yet-released) changes I made to the linker to better support xml serialization.

Now I hope this is 'b' ;-) and I'll test the same test case I've made (from your code) in an earlier version of MonoTouch (to see if it works or if I can duplicate your issue). 

However that won't tell me if we're hitting case 'a'. To be 100% sure could you:

a) set your simulator build to use "Link SDK assemblies only", rebuild and test

b) set your device build to "Don't link", rebuild and test

and report your results here. Thanks!
Comment 4 steve 2011-10-24 05:29:22 UTC
Was trying to reproduce myself on 2011-10-22, but unable to.  Might be worth putting this issue on HOLD for a while to see if reproduceable.  Had the issue for a whole development session (maybe 4-6 hours) whereby serialization failed with exception quoted in the bug.  After shutting down and trying to reproduce the following day (without any code changes in between) - unable to produce.
Comment 5 Sebastien Pouliot 2011-10-24 07:41:44 UTC
np, I'll leave this bug as NEEDINFO until you can reproduce the issue or close it
Comment 6 Sebastien Pouliot 2011-11-23 16:56:44 UTC
Hello Steve, have you been able to reproduce this in the last month ? or should we close the bug (it can be re-opened later if you ever hit the issue again). Thanks.
Comment 7 Sebastien Pouliot 2012-01-16 11:20:26 UTC
Closing. Please re-open if you can duplicate this again.