Attempting to JIT compile method (....) while running with --aot-only.

FranciscoGGFranciscoGG ESMember ✭✭
edited December 2015 in Xamarin.Forms

Hi to all.

I am getting this exception when I process a WCF request from my Xamarin.Forms app:

"Attempting to JIT compile method '(wrapper runtime-invoke) :runtime_invoke_bool_Nullable`1 (object,intptr,intptr,intptr)' while running with --aot-only.
See for more information.\n"

Please, how could I fix this? I have checked the server side but it seems ok.

The rest of WCF requests are working fine and this only happens in devices (not in simulator).



  • FranciscoGGFranciscoGG ESMember ✭✭


  • TorbenKruseTorbenKruse DEMember ✭✭✭
    edited December 2015

    You are talking about Android right?

    You probably have AOT compilation activated.

  • FranciscoGGFranciscoGG ESMember ✭✭

    No @TorbenKruse, I am talking about iOS

  • AnthonyRamirezAnthonyRamirez USUniversity ✭✭✭


    Can you provide some additional information.

    What type of data are you pulling from your service?
    Do you have any sample code?
    Is there any chance you are doing reflection?

  • OnurHazarOnurHazar USUniversity ✭✭✭

    Attempting to JIT compile method 'PCLCrypto.DeriveBytes:GetBytes (string,byte[],int,int)' while running with --aot-only.
    See for more information.

    I am having the same issue when using encryption method using through PCLCrypto nuget package. I am using latest version of Xamarin.iOS. I finally unchecked the LLVM optimizing compiler option in build settings and it seems it worked.

  • FranciscoGGFranciscoGG ESMember ✭✭

    @AnthonyRamirez this happens when I process a WCF Request with a Nullable property previously filled.

    Exactly this one:

        public System.Nullable<decimal> Quantity {
            get {
                return this.QuantityField;
            set {
                if ((this.QuantityField.Equals(value) != true)) {
                    this.QuantityField = value;

    How can I fix this?

  • FranciscoGGFranciscoGG ESMember ✭✭

    Some workaround for this?

  • hvaughanhvaughan USMember ✭✭✭

    @ONURHAZAR @onur.hazar

    This should now be fixed. See this bug for details.

  • hvaughanhvaughan USMember ✭✭✭

    @hvaughan said:
    @ONURHAZAR @onur.hazar

    This should now be fixed. See this bug for details.

    Spoke too soon... :( Obviously I have not actually tested the fix.

  • FranciscoGGFranciscoGG ESMember ✭✭
    edited January 2016

    @hvaughan I have upgraded to the latest versions (from alpha channel) but the bug is still happening...

    Here is the link of an small proof of concept where the error is reproduced:

    If you open the file HomePage.xaml.cs (in Core project), put a breakpoint in line 50 and run the app in debug mode and in a phone (not in the simulator), you will see the error:!F0YnBZga!FKremIRiZTh11qub9ZQCVx87oLLBeJXjonQF4ZF0kFA

    "Attempting to JIT compile method '(wrapper runtime-invoke) :runtime_invoke_bool_Nullable`1 (object,intptr,intptr,intptr)' while running with --aot-only. See for more information.\n"

    "at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)\n at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /Users/builder/data/lanes/2377/73229919/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:295"

    I'm really really frustated with this exception :neutral:

  • hvaughanhvaughan USMember ✭✭✭

    They do have a project that reproduces the bug and is connected to that bug report (I think it's private though).

    I asked Xamarin Support about the bug and specifically the last comment in there and they said "It's still untriaged and not been given a milestone release marker."

    They also said, about the last commenters post: "shows that it was not a regression. Instead, the underlying issue in Mono has always been there, it just was not discovered until the latest PCLCrypto library"

    I think an option would be to downgrade PCLCrypto to 1.0.2, since it does not hit the mono bug but I have not tried that yet. Definitely let me know if you try it and it works for you!

  • FranciscoGGFranciscoGG ESMember ✭✭
    edited January 2016

    @hvaughan what is PCLCrypto, a Nuget library?

    I've never heard it.


  • hvaughanhvaughan USMember ✭✭✭

    Sorry about that. I assumed you were referring to the PCLCrypto library. It looks like you may want to create your own bug report with that issue. The problems may be related.

    You also might try downgrading any libraries that you might be using to call the WCF service. Can you think of any libraries that you are using in your solution to make the calls?

Sign In or Register to comment.