System.ExecutionEngineException: Attempting to JIT compile method 'ServiceStack.Text.Json.JsonReader

619 views
Skip to first unread message

Mark Swiatek

unread,
Mar 17, 2012, 10:17:35 AM3/17/12
to ServiceStack .NET Open Source REST Web Services Framework
In MonoTouch, the following code generates a JIT Exception:

if (Logger.IsInfoEnabled)
Logger.InfoFormat ("Getting URI: {0}", searchUri);

try
{
var courses =
AppConfig.ServiceClient.Get<GolfCourseResponse>(searchUri);
NavigationController.PushViewController(_courseScreen, true);
_courseScreen.LoadData(courses.GolfCourses, "Nearby Courses");
}
catch (Exception ex)
{
if (Logger.IsErrorEnabled)
Logger.Error ("Error getting courses near latitude/longitude",
ex);
using (var alertView = new UIAlertView("Error", ex.Message, null,
"OK", null))
{
alertView.Show();
}
}

The call works fine in the simulator. Any ideas?

Here's the exception dump. Thanks.

INFO [2012-03-17 10:09:07,242] ThirstyGolfer.CourseSearchScreen:
Getting URI: /coursesnear?
Latitude=43.2818858892105&Longitude=-77.7920335472186&Distance=7000
ERROR [2012-03-17 10:09:26,727] ThirstyGolfer.CourseSearchScreen:
Error getting courses near latitude/longitude
System.TypeInitializationException: An exception was thrown by the
type initializer for ServiceStack.Text.Json.JsonReader`1 --->
System.TypeInitializationException: An exception was thrown by the
type initializer for ServiceStack.Text.Json.JsonReader`1 --->
System.ExecutionEngineException: Attempting to JIT compile method
'ServiceStack.Text.Json.JsonReader`1<Thirsty.ServiceModel.Types.CourseTypes>:GetParseFn
()' while running with --aot-only.

at ServiceStack.Text.Json.JsonReader.GetParseFn (System.Type type)
[0x00000] in <filename unknown>:0
at ServiceStack.Text.Json.JsonTypeSerializer.GetParseFn (System.Type
type) [0x00000] in <filename unknown>:0
at
ServiceStack.Text.Common.DeserializeType`1[ServiceStack.Text.Json.JsonTypeSerializer].GetParseMethod
(System.Type type) [0x00000] in <filename unknown>:0
at
ServiceStack.Text.Common.JsReader`1[ServiceStack.Text.Json.JsonTypeSerializer].GetParseFn[GolfCourse]
() [0x00000] in <filename unknown>:0
at
ServiceStack.Text.Json.JsonReader`1[Thirsty.ServiceModel.Types.GolfCourse]..cctor
() [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at ServiceStack.Text.Json.JsonReader.GetParseFn (System.Type type)
[0x00000] in <filename unknown>:0
at ServiceStack.Text.Json.JsonTypeSerializer.GetParseFn (System.Type
type) [0x00000] in <filename unknown>:0
at
ServiceStack.Text.Common.DeserializeType`1[ServiceStack.Text.Json.JsonTypeSerializer].GetParseMethod
(System.Type type) [0x00000] in <filename unknown>:0
at
ServiceStack.Text.Common.JsReader`1[ServiceStack.Text.Json.JsonTypeSerializer].GetParseFn[GolfCourseResponse]
() [0x00000] in <filename unknown>:0
at
ServiceStack.Text.Json.JsonReader`1[Thirsty.ServiceModel.Types.GolfCourseResponse]..cctor
() [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at
ServiceStack.Text.JsonSerializer.DeserializeFromString[GolfCourseResponse]
(System.String value) [0x00000] in <filename unknown>:0
at
ServiceStack.Text.JsonSerializer.DeserializeFromStream[GolfCourseResponse]
(System.IO.Stream stream) [0x00000] in <filename unknown>:0
at
ServiceStack.ServiceModel.Serialization.JsonDataContractDeserializer.DeserializeFromStream[GolfCourseResponse]
(System.IO.Stream stream) [0x00000] in <filename unknown>:0
at
ServiceStack.ServiceClient.Web.JsonServiceClient.DeserializeFromStream[GolfCourseResponse]
(System.IO.Stream stream) [0x00000] in <filename unknown>:0
at
ServiceStack.ServiceClient.Web.ServiceClientBase.Send[GolfCourseResponse]
(System.String httpMethod, System.String relativeOrAbsoluteUrl,
System.Object request) [0x00000] in <filename unknown>:0

Demis Bellot

unread,
Mar 17, 2012, 11:07:51 AM3/17/12
to servic...@googlegroups.com
Yeah iOS/MonoTouch doesn't allow JIT and your code looks like it's executing a code path that requires JIT, this normally happens when you try to call  a generic method.

The idea is to tell MonoTouch upfront what generic methods/classes it needs to create upfront so it can pre-compile the support it needs at the AOT stage so it doesn't need it at runtime. This is where I try adding all the generic calls SS.Text needs up front:

It's likely its missing the code-path that you need. 

Unfortunately I don't have time to look at this myself before the next release is out (and my MonoTouch licence is out of date).

So I would download a fork and try adding to this things you might need / i.e what it errors out on.

Mark Swiatek

unread,
Mar 17, 2012, 6:44:38 PM3/17/12
to ServiceStack .NET Open Source REST Web Services Framework
It was choking on an enumeration, which I would assume is ultimately
an int. Is that still something that would be fixed where you suggest,
or is there a different issue.

On Mar 17, 11:07 am, Demis Bellot <demis.bel...@gmail.com> wrote:
> Yeah iOS/MonoTouch doesn't allow JIT and your code looks like it's
> executing a code path that requires JIT, this normally happens when you try
> to call  a generic method.
>
> The idea is to tell MonoTouch upfront what generic methods/classes it needs
> to create upfront so it can pre-compile the support it needs at the AOT
> stage so it doesn't need it at runtime. This is where I try adding all the
> generic calls SS.Text needs up front:https://github.com/ServiceStack/ServiceStack.Text/blob/master/src/Ser...
> > ServiceStack.Text.Common.DeserializeType`1[ServiceStack.Text.Json.JsonTypeS erializer].GetParseMethod
> > (System.Type type) [0x00000] in <filename unknown>:0
> >  at
>
> > ServiceStack.Text.Common.JsReader`1[ServiceStack.Text.Json.JsonTypeSerializ er].GetParseFn[GolfCourse]
> > () [0x00000] in <filename unknown>:0
> >  at
>
> > ServiceStack.Text.Json.JsonReader`1[Thirsty.ServiceModel.Types.GolfCourse]. .cctor
> > () [0x00000] in <filename unknown>:0
> >  --- End of inner exception stack trace ---
> >  at ServiceStack.Text.Json.JsonReader.GetParseFn (System.Type type)
> > [0x00000] in <filename unknown>:0
> >  at ServiceStack.Text.Json.JsonTypeSerializer.GetParseFn (System.Type
> > type) [0x00000] in <filename unknown>:0
> >  at
>
> > ServiceStack.Text.Common.DeserializeType`1[ServiceStack.Text.Json.JsonTypeS erializer].GetParseMethod
> > (System.Type type) [0x00000] in <filename unknown>:0
> >  at
>
> > ServiceStack.Text.Common.JsReader`1[ServiceStack.Text.Json.JsonTypeSerializ er].GetParseFn[GolfCourseResponse]
> > () [0x00000] in <filename unknown>:0
> >  at
>
> > ServiceStack.Text.Json.JsonReader`1[Thirsty.ServiceModel.Types.GolfCourseRe sponse]..cctor
> > () [0x00000] in <filename unknown>:0
> >  --- End of inner exception stack trace ---
> >  at
> > ServiceStack.Text.JsonSerializer.DeserializeFromString[GolfCourseResponse]
> > (System.String value) [0x00000] in <filename unknown>:0
> >  at
> > ServiceStack.Text.JsonSerializer.DeserializeFromStream[GolfCourseResponse]
> > (System.IO.Stream stream) [0x00000] in <filename unknown>:0
> >  at
>
> > ServiceStack.ServiceModel.Serialization.JsonDataContractDeserializer.Deseri alizeFromStream[GolfCourseResponse]

Gerry High

unread,
Feb 4, 2013, 5:21:42 PM2/4/13
to servic...@googlegroups.com
Anyone know if this has been fixed?  I'm still seeing this issue with enums but am running a build of ServiceStack.Text from 2-3 months ago.

Demis Bellot

unread,
Feb 4, 2013, 6:48:00 PM2/4/13
to servic...@googlegroups.com
I haven't had a chance to look at it myself but I recall Sergey (@desunit) did some work on it a little while back.
I'd try using a new build from src.


--
You received this message because you are subscribed to the Google Groups "ServiceStack .NET Open Source REST Web Services Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to servicestack...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages