1

I am using the MonoTouch build of Service Stack from https://github.com/ServiceStack/ServiceStack/tree/master/release/latest/MonoTouch

When run on a iPad, I get a JIT error. I thought MonoTouch took care of that in the build?

Attempting to JIT compile method     
'ServiceStack.Text.Json.JsonReader`1<Common.AppCategoryEnum>:GetParseFn ()' while running 
with --aot-only.

I use the DLLS:

  • ServiceStack.Common.dll
  • ServiceStack.Interface.dll
  • ServiceStack.Text.dll

And only this single call:

new JsonServiceClient ().GetAsync<MyResponse> (url, Success, Failure);
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
  • Are you using MonoTouch 5.2.x or 5.3.x ? – poupou Apr 10 '12 at 18:49
  • MonoDevelop 2.8.8.4 Installation UUID: 438ac2b5-07c9-45e7-a8ce-eac5ad86371d Runtime: Mono 2.10.9 (tarball Tue Mar 20 15:31:37 EDT 2012) GTK 2.24.10 GTK# (2.12.0.0) Apple Developer Tools: Xcode 4.3.1 (1176) Build 4E1019 Monotouch: 5.2.10 – Ian Vink Apr 10 '12 at 18:54
  • more details in bug report filled as https://bugzilla.xamarin.com/show_bug.cgi?id=4381 – poupou Apr 11 '12 at 12:41

2 Answers2

4

I am using the MonoTouch build of Service Stack from

Those .dll are more than 3 months old and a similar issue was found and fixed one month ago.

I get a JIT error. I thought MonoTouch took care of that in the build?

Yes. When building for MonoTouch the AOT (ahead of time) compiler is used. It compiles everything it knows it will require at runtime.

However sometimes the AOT compiler cannot know everything (e.g. generic virtual methods) or compile every possible variations (e.g. value types). See the section generic limitations in the documentation web site. In such case it AOT compiler might need help (a signature that will ensure the right code will be compiled, e.g. something like this).

It can also be a bug - where a required method was not AOT'ed for some reason. When this is discovered, at runtime, an exception will occurs because the code is missing and the JIT cannot be used to provide it.

poupou
  • 43,413
  • 6
  • 77
  • 174
1

I know it has been a long time this thread was created but I somewhat find here and there a workaround just call var dummy = new JsonSerializer() in the AppDelegate in the FinishedLaunching method.

Ronny
  • 105
  • 7