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
java-interopIssues migrated from dotnet/java-interop / relates to the Java.Interop subtreeneeds-triageIssues that need to be assigned.possibly-staleIssues that are potentially no longer relevant.
The WeakReference code is effectively dead. The contents of src/java-interop is a "desktop port" of GC bridge code from dotnet/android for use with MonoVM, which we never got around to unifying. The WeakReference backend is no longer supported; see 2f93f76
Additionally, note that the use of WeakReference was when JNI Weak Global References didn't work (Android < API-14).
I was wrong. (Or at least, not quite right.)
2f93f763 removes support for JNI Global References being direct object pointers. Meaning instead of there being an indirection (GREF value > GREF table > object instance), the GREF value was the object instance. In a world in which objects can move around in memory due to GC, "direct" references cannot work, but Android worked this way for quite some time (through API-13).
Consequently, 2f93f763 is entirely unrelated to our code to use java.lang.ref.WeakReference instead of JNI Weak Global References.
e98ae9c removes support for debug.mono.wref=java, java.lang.ref.WeakReference, and the weak_handle fields from Java.Lang.Object, Java.Lang.Exception, Java.Interop.JavaObject, and Java.Interop.JavaException.
We suspect this issue is stale and no longer relevant. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
This issue will now be closed since it had been marked "possibly-stale" but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.
java-interopIssues migrated from dotnet/java-interop / relates to the Java.Interop subtreeneeds-triageIssues that need to be assigned.possibly-staleIssues that are potentially no longer relevant.
Activity
jonpryor commentedon Oct 23, 2024
I had written:
I was wrong. (Or at least, not quite right.)
2f93f763 removes support for JNI Global References being direct object pointers. Meaning instead of there being an indirection (GREF value > GREF table > object instance), the GREF value was the object instance. In a world in which objects can move around in memory due to GC, "direct" references cannot work, but Android worked this way for quite some time (through API-13).
Consequently, 2f93f763 is entirely unrelated to our code to use
java.lang.ref.WeakReferenceinstead of JNI Weak Global References.The
java.lang.ref.WeakReferencecode can be used by setting thedebug.mono.wrefsystem property.That said, we have no current tests which set this property, and I see no obvious usage of
debug.mono.wrefon GitHub, so while this code may not be "dead", it's close to it[native, Mono.Android] Remove WeakReference support
[native, Mono.Android] Remove WeakReference support
[native, Mono.Android] Remove WeakReference support
[native, Mono.Android] Remove WeakReference support (#9454)
jonpryor commentedon Oct 25, 2024
e98ae9c removes support for
debug.mono.wref=java,java.lang.ref.WeakReference, and theweak_handlefields fromJava.Lang.Object,Java.Lang.Exception,Java.Interop.JavaObject, andJava.Interop.JavaException.Development of dotnet/java-interop#1257 can resume, if desired.
filipnavara commentedon Oct 25, 2024
I'll get to it in the upcoming week[s]. Thanks for the Android PR!
dotnet-policy-service commentedon Jul 1, 2026
We suspect this issue is stale and no longer relevant. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
dotnet-policy-service commentedon Jul 15, 2026
This issue will now be closed since it had been marked "possibly-stale" but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.