Open
Description
Android framework version
net9.0-android
Affected platform version
.NET 9 RC 2
Description
I was trying to enable "full AOT" and disable JIT on Android:
dotnet new maui
- remove the other platforms beside Androiddotnet build build -c Release -p:AndroidAotMode=full -p:AndroidEnableProfiledAot=false -p:RunAOTCompilation=true -r android-arm64 -bl -t:Run
This should "AOT everything" and also toggle MONO_AOT_MODE_FULL
at runtime.
This appears to pass the right flags to the <MonoAOTCompiler/>
task:
And at runtime:
10-30 08:58:14.982 9378 9378 D monodroid: Mono AOT mode: full
...
10-30 08:58:14.982 9378 9378 D monodroid: Probing for Mono AOT mode
10-30 08:58:14.982 9378 9378 D monodroid: Enabling AOT mode in Mono
10-30 08:58:14.982 9378 9378 D monodroid: Probing if we should use LLVM
android/src/native/monodroid/monodroid-glue.cc
Line 1479 in aa668a5
But then the JIT is still used and we crash:
10-30 08:58:15.015 9378 9378 F mono-rt : [ERROR] FATAL UNHANDLED EXCEPTION: System.ExecutionEngineException: Attempting to JIT compile method '(wrapper other) void Java.Interop.JavaVMInterface:PtrToStructure (intptr,object)' while running in aot-only mode. See https://learn.microsoft.com/xamarin/ios/internals/limitations for more information.
10-30 08:58:15.015 9378 9378 F mono-rt :
10-30 08:58:15.015 9378 9378 F mono-rt : at System.Runtime.InteropServices.Marshal.PtrToStructure[JavaVMInterface](IntPtr )
10-30 08:58:15.015 9378 9378 F mono-rt : at Java.Interop.JniRuntime.CreateInvoker(IntPtr )
10-30 08:58:15.015 9378 9378 F mono-rt : at Java.Interop.JniRuntime..ctor(CreationOptions )
10-30 08:58:15.015 9378 9378 F mono-rt : at Android.Runtime.AndroidRuntime..ctor(IntPtr , IntPtr , IntPtr , IntPtr , Boolean )
10-30 08:58:15.015 9378 9378 F mono-rt : at Android.Runtime.JNIEnvInit.Initialize(JnienvInitializeArgs* )
Perhaps it fails on the first generic method?
Steps to Reproduce
See above.
Did you find any workaround?
No.