ServiceStack.Client related code is having an exception when debugging in real devices

I am using ServiceStack.Client (5.0.2) in a Xamarin.Form (.NET Standard 2.0) project. When debugging the iOS app on iOS devices, it throws an exception: System.ExecutionEngineException:
Attempting to JIT compile method ‘(wrapper delegate-invoke) :invoke_callvirt_void_HttpWebRequest_bool (System.Net.HttpWebRequest,bool)’ while running in aot-only mode. See for more information.

Running with Simulators doesn’t have this issue.

Part of my code is as the following:

using ServiceStack;

private static JsonServiceClient apiClient = new JsonServiceClient(“https://someurl”);

var auth = new Authenticate();
auth.UserName = name;
auth.Password = password;
authResp = apiClient.Post(auth);

I appreciate any help in advance.

Have you tried Skip Linking Assemblies for ServiceStack.Text;ServiceStack.Client;ServiceModel (where ServiceModel = DTOs).

I already tried skipping them, changing Linker behaviors and still no luck.


This should now be resolved from the latest v5.1.1 available on MyGet.

I’ve updated the HelloMobile to use the latest deps, if you had v5.1.1 previously installed you’ll need to clear your NuGet cache with:

$ nuget locals all -clear

It look like we have included .Core package and regular package in a .NetStandard20 project. With the regular Client only now it work.

We are having issue for debugging on the device but I don’t think it’s related to SS.

When we have breakpoint enable VS is waiting the device to hit the breakpoint but it hang… If we disable all breakpoint it run OK.