Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mono.Android] update more TypeManager.GetClassName() calls #9865

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

jonathanpeppers
Copy link
Member

Mono.Android has various test failures under NativeAOT such as:

02-28 16:35:29.583 18438 18456 I NUnit   : CastJavaLangObjectArrayToByteArrayThrows
02-28 16:35:29.586 18438 18456 E NUnit   :      [FAIL]
02-28 16:35:29.586 18438 18456 E NUnit   :  :   Expected: <System.InvalidCastException>
02-28 16:35:29.586 18438 18456 E NUnit   :   But was:  <System.DllNotFoundException> (DllNotFound_Linux, xa-internal-api,
02-28 16:35:29.586 18438 18456 E NUnit   : dlopen failed: library "xa-internal-api.so" not found
02-28 16:35:29.586 18438 18456 E NUnit   : dlopen failed: library "libxa-internal-api.so" not found
02-28 16:35:29.586 18438 18456 E NUnit   : dlopen failed: library "xa-internal-api" not found
02-28 16:35:29.586 18438 18456 E NUnit   : dlopen failed: library "libxa-internal-api" not found
02-28 16:35:29.586 18438 18456 E NUnit   : )
02-28 16:35:29.586 18438 18456 E NUnit   :    at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0x4c
02-28 16:35:29.586 18438 18456 E NUnit   :    at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0x134
02-28 16:35:29.586 18438 18456 E NUnit   :    at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x40
02-28 16:35:29.586 18438 18456 E NUnit   :    at Android.Runtime.RuntimeNativeMethods.monodroid_TypeManager_get_java_class_name(IntPtr klass) + 0x2c
02-28 16:35:29.586 18438 18456 E NUnit   :    at Java.Interop.TypeManager.GetClassName(IntPtr) + 0x10
02-28 16:35:29.586 18438 18456 E NUnit   :    at Android.Runtime.JNIEnv.AssertCompatibleArrayTypes(IntPtr, Type) + 0x58
02-28 16:35:29.586 18438 18456 E NUnit   :    at Android.Runtime.JNIEnv.GetArray[T](IntPtr array_ptr) + 0x24
02-28 16:35:29.586 18438 18456 E NUnit   :    at Java.LangTests.ObjectArrayMarshaling.<>c__DisplayClass0_0.<CastJavaLangObjectArrayToByteArrayThrows>b__0() + 0x18
02-28 16:35:29.586 18438 18456 E NUnit   :    at NUnit.Framework.Assert.Throws(IResolveConstraint, TestDelegate, String, Object[]) + 0xc4
02-28 16:35:29.586 18438 18456 E NUnit   :    at Java.LangTests.ObjectArrayMarshaling.CastJavaLangObjectArrayToByteArrayThrows() + 0x150
02-28 16:35:29.586 18438 18456 E NUnit   :    at libMono.Android.NET-Tests!<BaseAddress>+0x152f704
02-28 16:35:29.586 18438 18456 E NUnit   :    at System.Reflection.DynamicInvokeInfo.Invoke(Object, IntPtr, Object[], BinderBundle, Boolean) + 0x10c

I updated the remaining calls in JNIEnv.cs to use JniEnvironment.Types.GetJniTypeNameFromClass() instead.

`Mono.Android` has various test failures under NativeAOT such as:

    02-28 16:35:29.583 18438 18456 I NUnit   : CastJavaLangObjectArrayToByteArrayThrows
    02-28 16:35:29.586 18438 18456 E NUnit   :      [FAIL]
    02-28 16:35:29.586 18438 18456 E NUnit   :  :   Expected: <System.InvalidCastException>
    02-28 16:35:29.586 18438 18456 E NUnit   :   But was:  <System.DllNotFoundException> (DllNotFound_Linux, xa-internal-api,
    02-28 16:35:29.586 18438 18456 E NUnit   : dlopen failed: library "xa-internal-api.so" not found
    02-28 16:35:29.586 18438 18456 E NUnit   : dlopen failed: library "libxa-internal-api.so" not found
    02-28 16:35:29.586 18438 18456 E NUnit   : dlopen failed: library "xa-internal-api" not found
    02-28 16:35:29.586 18438 18456 E NUnit   : dlopen failed: library "libxa-internal-api" not found
    02-28 16:35:29.586 18438 18456 E NUnit   : )
    02-28 16:35:29.586 18438 18456 E NUnit   :    at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0x4c
    02-28 16:35:29.586 18438 18456 E NUnit   :    at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0x134
    02-28 16:35:29.586 18438 18456 E NUnit   :    at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x40
    02-28 16:35:29.586 18438 18456 E NUnit   :    at Android.Runtime.RuntimeNativeMethods.monodroid_TypeManager_get_java_class_name(IntPtr klass) + 0x2c
    02-28 16:35:29.586 18438 18456 E NUnit   :    at Java.Interop.TypeManager.GetClassName(IntPtr) + 0x10
    02-28 16:35:29.586 18438 18456 E NUnit   :    at Android.Runtime.JNIEnv.AssertCompatibleArrayTypes(IntPtr, Type) + 0x58
    02-28 16:35:29.586 18438 18456 E NUnit   :    at Android.Runtime.JNIEnv.GetArray[T](IntPtr array_ptr) + 0x24
    02-28 16:35:29.586 18438 18456 E NUnit   :    at Java.LangTests.ObjectArrayMarshaling.<>c__DisplayClass0_0.<CastJavaLangObjectArrayToByteArrayThrows>b__0() + 0x18
    02-28 16:35:29.586 18438 18456 E NUnit   :    at NUnit.Framework.Assert.Throws(IResolveConstraint, TestDelegate, String, Object[]) + 0xc4
    02-28 16:35:29.586 18438 18456 E NUnit   :    at Java.LangTests.ObjectArrayMarshaling.CastJavaLangObjectArrayToByteArrayThrows() + 0x150
    02-28 16:35:29.586 18438 18456 E NUnit   :    at libMono.Android.NET-Tests!<BaseAddress>+0x152f704
    02-28 16:35:29.586 18438 18456 E NUnit   :    at System.Reflection.DynamicInvokeInfo.Invoke(Object, IntPtr, Object[], BinderBundle, Boolean) + 0x10c

I updated the remaining calls in `JNIEnv.cs` to use
`JniEnvironment.Types.GetJniTypeNameFromClass()` instead.
@jonathanpeppers jonathanpeppers marked this pull request as ready for review March 2, 2025 03:27
@jonpryor jonpryor merged commit 8518ee0 into main Mar 3, 2025
58 checks passed
@jonpryor jonpryor deleted the dev/peppers/JNIEnvGetClassName branch March 3, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants