You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Mono.Android] fix JavaConvert.GetTypeMapping() for NativeAOT (#9864)
Context: #9846
Mono.Android-Tests running on NativeAOT can have a failure such as:
I NUnit : Indexer
E NUnit : [FAIL]
E NUnit : : System.DllNotFoundException : DllNotFound_Linux, xa-internal-api,
E NUnit : dlopen failed: library "xa-internal-api.so" not found
E NUnit : dlopen failed: library "libxa-internal-api.so" not found
E NUnit : dlopen failed: library "xa-internal-api" not found
E NUnit : dlopen failed: library "libxa-internal-api" not found
E NUnit : at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0x4c
E NUnit : at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0x134
E NUnit : at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x40
E NUnit : at Android.Runtime.RuntimeNativeMethods.monodroid_TypeManager_get_java_class_name(IntPtr klass) + 0x2c
E NUnit : at Java.Interop.TypeManager.GetClassName(IntPtr) + 0x10
E NUnit : at Java.Interop.JavaConvert.GetTypeMapping(IntPtr) + 0x28
E NUnit : at Java.Interop.JavaConvert.FromJniHandle(IntPtr handle, JniHandleOwnership transfer, Type targetType) + 0x84
E NUnit : at Android.Runtime.JavaList.InternalGet(Int32, Type) + 0x90
E NUnit : at Java.InteropTests.JavaListTest`1.Indexer() + 0xfc
E NUnit : at libMono.Android.NET-Tests!<BaseAddress>+0x152f744
E NUnit : at System.Reflection.DynamicInvokeInfo.Invoke(Object, IntPtr, Object[], BinderBundle, Boolean) + 0x10c
We can update `JavaConvert.GetTypeMapping()` to use
`JniEnvironment.Types.GetJniTypeNameFromClass()` the same way it is
[done in dotnet/java-interop][0].
With this change the test passes:
I NUnit : Indexer
I NUnit : Passed
[0]: https://github.com/dotnet/java-interop/blob/719e615910923bbce10e74b05bcc6b9585d4e176/src/Java.Interop/Java.Interop/JniEnvironment.Types.cs#L214-L220
0 commit comments