[MonoTouch] Reflection / Serialization broken on device?

Sebastien Pouliot sebastien at xamarin.com
Fri Oct 21 09:20:17 EDT 2011


Hello Steve,

On Fri, Oct 21, 2011 at 8:54 AM, MonkeyWorld <steve at rennocks.co.uk> wrote:
> I'm using the XmlSerializer to read/write my apps data and all works fine in
> the simulator plus when my app is built with the LLVM optimizing compiler,

Note that the LLVM compiler is not used on the simulator (even if MD
lets you select it) since MonoTouch use the JIT in this case (much
faster build times).

> however, with LLVM off it fails on the device...

Can you check:

a) what's your linker setting for devices builds;

b) if it fails without using LLVM (i.e. built with the default AOT compiler);

> Get *System.NullReference* exception in
> *System.Xml.Serialization.XmlReflectionImporter..ctor()*
>
> on this line...
>
> XmlSerializer xs = new XmlSerializer (typeof(ExpenseData));
>
> - where ExpenseData is class marked as serializable (and that does
> (de)serialize fine on simulator + device with LLVM).

We'll likely need to see the ExpenseData type itself. You can fill a
bug report and mark it private if you cannot share this with everyone
on the list.

> This is with iOS 5, MT 5.0, MD 2.8.
>
> I'm fairly certain my ExpenseData class hasn't changed in quite some time
> and used to serialize fine with previous versions of iOS and/or MT.


Thanks
Sebastien


More information about the MonoTouch mailing list