I have an iOS app, working and running in the Apple store. I have made some changes to it, mostly converting it to a Unified API project so I can continue to submit updates, and moving a bunch of classes into either a portable class library or an iOS library (I have one of each) depending where they fit. Now when I try to run the app on the simulator, when a particular Xaml page is shown I get this exception;
System.ExecutionEngineException: Attempting to JIT compile method 'Xamarin.Forms.OnPlatform`1<Xamarin.Forms.Thickness>:.ctor ()
I believe this is caused by the following piece of XAML in the page being shown;
<local:ContentViewBase.Padding>
<OnPlatform x:TypeArguments="Thickness">
<OnPlatform.iOS>12,20,12,0</OnPlatform.iOS>
</OnPlatform>
</local:ContentViewBase.Padding>
However, this Xaml is not new (it was in the app prior to my changes) and has always worked previously. I believe it should be valid (in fact I think I stole it from a Xamarin sample somewhere). I'm not really sure how to work around the problem either. I guess I can set the value in code behind but that seems ugly and unnecessary. Obviously this is only a problem on iOS due to it's limitations with JIT vs AOT compilation, new version of app works fine on WP (and in iOS simulator).
Anyone got any ideas why this is suddenly a problem?
This isn't the first new problem I've had like this. I had a bunch of other code using generics that used to work fine and started causing a similar error (so I rewrote the code without generics since I couldn't see another way to fix it). I've also suddenly had to mark a whole bunch of stuff with the Preserve attribute to prevent the linker from removing it (didn't have to do this previously). I put this down to the Unified API changes/today's Xamarin iOS update, but this particular problem bothers me enough to post and ask if anyone else is seeing this or has a clue what the cause is?
Thanks.
Troy