Created attachment 6552 [details]
Service Stack JIT Compile Exception
I recently upgraded to the ServiceStack Client PCL library and in the most recent Beta release (184.108.40.206) I'm receiving an exception - only when run from the device (Full AOT)
Unhandled managed exception: Attempting to JIT compile method '(wrapper delegate-invoke) <Module>:invoke_callvirt_Nullable`1<bool>_Authenticate (ServiceStack.Authenticate)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.
at (wrapper unknown) object:gsharedvt_out ()
at Microsoft.Scripting.Interpreter.FuncCallInstruction`2[ServiceStack.Authenticate,System.Nullable`1[System.Boolean]].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.Generated.cs:692
at Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x0001b] in /Developer/MonoTouch/Source/mono/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Interpreter.cs:126
Note that this does NOT occur in the most recent Stable release (220.127.116.11).
At this point it's difficult for me to say whether this is really a bug in the library or not due to the fact it works in Stable.
I've attached a sample project that exhibits the behavior.
Running the project on the device in the most recent Stable release (18.104.22.168) will still throw an exception, but it will be some form of a "Bad Request" because the test project attempts to connect to a bogus host. This is expected.
Running the project on the device in the most recent Beta (22.214.171.124) release will throw the "JIT Compile" exception noted above before any request is actually made to the (bogus) host.
A newer build (post .34) fixed some issue in SLE (even if Expressions are not fully supported).
Running your sample I get this exception:
2014-04-10 17:03:03.473 ServiceStackPCLTest[5684:60b] Unhandled managed exception: Not Found (ServiceStack.WebServiceException)
at ServiceStack.ServiceClientBase.ThrowWebServiceException[AuthenticateResponse] (System.Exception ex, System.String requestUri) [0x00000] in <filename unknown>:0
at ServiceStack.ServiceClientBase.ThrowResponseTypeException[AuthenticateResponse] (System.Object request, System.Exception ex, System.String requestUri) [0x00000] in <filename unknown>:0
at ServiceStack.ServiceClientBase.HandleResponseException[AuthenticateResponse] (System.Exception ex, System.Object request, System.String requestUri, System.Func`1 createWebRequest, System.Func`2 getResponse, ServiceStack.AuthenticateResponse& response) [0x00000] in <filename unknown>:0
at ServiceStack.ServiceClientBase.Send[AuthenticateResponse] (System.Object request) [0x00000] in <filename unknown>:0
at ServiceStack.ServiceClientBase.Send[AuthenticateResponse] (IReturn`1 request) [0x00000] in <filename unknown>:0
at ServiceStackPCLTest.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00069] in /Users/sebastienpouliot/Downloads/ServiceStackJITCompile/ServiceStackPCLTest/AppDelegate.cs:45
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string,intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pmcs-compat.UIApplication.cs:38
at ServiceStackPCLTest.Application.Main (System.String args) [0x00008] in /Users/sebastienpouliot/Downloads/ServiceStackJITCompile/ServiceStackPCLTest/Main.cs:16
That is the exception I would expect to receive in the working case. This means the request was actually sent, but I purposely sent it to a bad host because a truly "working" example would have required more infrastructure than I have time to deal with.
I apologize for the confusion.
If this is the result from a "post .34" build, it appears to have been fixed?
Duplicate of #18688
*** This bug has been marked as a duplicate of bug 18688 ***
@Josh there's a new beta available - and it should fix your issue.