CSLA for MonoTouch JIT errors on iPad device

CSLA for MonoTouch JIT errors on iPad device

Old forum URL: forums.lhotka.net/forums/t/10991.aspx


jhardman posted on Thursday, December 15, 2011

Has anybody actually tried the Ios sample called SimpleApp on an iDevice using MonoTouch?  I am using CSLA 4.2.2.  The sample works ok on the simulator but it fails on an actual iPad device.  I expect the same error would occur on iPhone devices as well.  It gets the following error:

System.ExecutionEngineException has been thrown.

Attempting to JIT compile method 'Csla.Core.FieldManager.DefaultPropertyInfoFactory:Create<int> (System.Type,string)' while running with --aot-only.

 

  at Csla.BusinessBase`1[Library.CustomerEdit].RegisterProperty[Int32] (System.Linq.Expressions.Expression`1 propertyLambdaExpression) [0x00000] in <filename unknown>:0 

  at Library.CustomerEdit..cctor () [0x00000] in <filename unknown>:0 

 

 

It works on the simulator because JIT works in the Mac environment and hence works in the simulator.  MonoTouch does not allow JIT because it is a limitation from Apple on iOS.

The error was occurring when trying to RegisterProperty.  So I changed the lines to not use the lambda expression so I didn't have to modify the CSLA framework e.g.

changed

 

private static PropertyInfo<int> IdProperty = RegisterProperty<int> (c => c.Id);

to

private static PropertyInfo<int> IdProperty = RegisterProperty<int> (new PropertyInfo<int>("Id"));

After doing this and debugging it again on the iPad, I then get the same exception with a different message:

Attempting to JIT compile method 'Csla.ReadOnlyBase`1<Csla.Security.UnauthenticatedIdentity>:RegisterProperty<bool> (System.Linq.Expressions.Expression`1<System.Func`2<Csla.Security.UnauthenticatedIdentity, object>>)' while running with --aot-only.

  at Csla.Security.CslaIdentityBase`1[Csla.Security.UnauthenticatedIdentity]..cctor () [0x00000] in <filename unknown>:0 

 

The error acutally occurs when getting the CustomerEdit.Name value:

 

get { return GetProperty (NameProperty); }

I really like using CSLA and would love to do so in MonoTouch.  But it appears that CSLA is not quite ready for MonoTouch even though the 4.2.2 release was specifically for MonoTouch and MonoDroid support.

 

 

RockfordLhotka replied on Friday, December 16, 2011

Stuart is looking into this.

Copyright (c) Marimer LLC