Invalid IL Code at runtime after hybrid aot compilation RRS feed

  • Question

  • User392746 posted


    My current customer has a Xamarin.Forms app, which will be published soon. For code protection reasons I tried hybrid aot compilation with the following settings:


    The compilation succeeded and the IL code is no longer part of the assemblies. The methods are only stubs now.

    But at runtime, we're getting exceptions:

    System.InvalidProgramException: Invalid IL code in {my namespace}.{my class}:{my method} (single,single): IL_0000: ret

    The code of that method is:

            public static T MyMethod<T>(T value1, T value2)
                return value2;
                return value1;

    JetBrains dotPeek shows the IL code as:

      .method public hidebysig static !!0/*T*/
          !!0/*T*/ 'value',
          !!0/*T*/ value2
        ) cil managed noinlining
        .maxstack 8
        IL_0000: ret

    The given method is not the only one. If I comment this one out, I get the same error in another method. May be, that they are all generic, but I don't know this exactly.

    Xamarin (d16-4@ddfd842) Xamarin.Android SDK (d16-4/e44d1ae)

    What can cause this problem?

    Thanks for every help! Timo

    Wednesday, February 12, 2020 11:51 AM

All replies