-
Notifications
You must be signed in to change notification settings - Fork 540
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
Bump to dotnet/java-interop/main@5852e6e3 #9931
Merged
Merged
+1
−1
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context: dotnet/java-interop#1326 Does It Build™?
…and it crashes! Mono.Android.NET_Tests-Debug has
|
This will hopefully fix the `Java.Lang.ClassNotFoundException` that was seen in the previous commit.
jonpryor
added a commit
to dotnet/java-interop
that referenced
this pull request
Mar 19, 2025
Context: dotnet/android#9931 Context: dotnet/android#9931 (comment) The attempted integration test crashed! F mono-rt : [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.ClassNotFoundException: Didn't find class "crc641855b07eca6dcc03.MyCb" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib64, /system/product/lib64, /system/lib64, /system/product/lib64]] F mono-rt : at Java.Interop.JniEnvironment.Types.TryFindClass(String classname, Boolean throwOnError) F mono-rt : at Java.Interop.JniEnvironment.Types.FindClass(String classname) F mono-rt : at Java.Interop.JniType..ctor(String classname) F mono-rt : at Java.Interop.JniPeerMembers.JniInstanceMethods..ctor(Type declaringType) F mono-rt : at Java.Interop.JniPeerMembers.JniInstanceMethods.GetConstructorsForType(Type declaringType) F mono-rt : at Java.Interop.JniPeerMembers.JniInstanceMethods.StartCreateInstance(String constructorSignature, Type declaringType, JniArgumentValue* parameters) F mono-rt : at Java.Lang.Object..ctor() F mono-rt : at Java.InteropTests.MyCb..ctor() F mono-rt : at Java.InteropTests.JnienvTest.<>c__DisplayClass29_0.<DoNotLeakWeakReferences>b__1() F mono-rt : at System.Threading.Thread.StartHelper.Callback(Object state) F mono-rt : at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) F mono-rt : --- End of stack trace from previous location --- F mono-rt : at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) F mono-rt : --- End of managed Java.Lang.ClassNotFoundException stack trace --- F mono-rt : java.lang.ClassNotFoundException: Didn't find class "crc641855b07eca6dcc03.MyCb" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/system/lib64, /system/product/lib64, /system/lib64, /system/product/lib64]] F mono-rt : at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196) F mono-rt : at java.lang.ClassLoader.loadClass(ClassLoader.java:379) F mono-rt : at java.lang.ClassLoader.loadClass(ClassLoader.java:312) Perhaps unsurprisingly, we need to provide the system ClassLoader in order to load types from outside the default "classpath", which is why we used `ClassLoader.loadClass()` in the first place. Instead of `Class.forName()`, use the [`Class.forName(String name, boolean initialize, ClassLoader loader)`][0] overload, so that we can provide a `ClassLoader` instance. This *should* fix the crash. [0]: https://developer.android.com/reference/java/lang/Class#forName(java.lang.String,%20boolean,%20java.lang.ClassLoader)
Fixes: dotnet/java-interop#23 Changes: dotnet/java-interop@bc44f08...5852e6e * dotnet/java-interop@5852e6e3: [Java.Interop] Use `Class.forName()` as fallback to load Java classes (dotnet/java-interop#1326)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: dotnet/java-interop#23
Changes: dotnet/java-interop@bc44f08...5852e6e
Class.forName()
as fallback to load Java classes ([Java.Interop] UseClass.forName()
as fallback to load Java classes java-interop#1326)