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
{{ message }}
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Crash in generated marshal method returning View #374
it should not call JniObjectReference.Dispose in the finally block as it will release the global reference
there seems to be unnecessary leave in try and catch blocks
unsed handle variable
The probable cause of the crash is that we are returning released gref. I need to look at JniEnvironment.References.NewReturnToJniRef in detail to confirm that.
CreateParameterFromManagedExpression() returns an Expression, but CreateReturnValueFromManagedExpression() doesn't use that return value. Why doesn't it? In retrospect, I think it would make more sense if CreateReturnValueFromManagedExpression() did:
That way, the return value isn't entirely ignored, instead of using a "+_ref" suffix logic to lookup a variable created elsewhere. The current code seems ugly.
Activity
jonpryor commentedon Sep 21, 2018
The problem is this line:
https://github.com/xamarin/java.interop/blob/8d5bcec11b6005447b736537af17faa50daa7a87/src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs#L601
Instead of calling
r.Dispose(), it should instead callr.DisposeUnlessReferenced().jonpryor commentedon Sep 21, 2018
This may be due to the decompiler, not the IL. Reading the actual IL might be illuminating here.
jonpryor commentedon Sep 21, 2018
I think this is a "bug"/"thinko": https://github.com/xamarin/java.interop/blob/8d5bcec11b6005447b736537af17faa50daa7a87/src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs#L609-L614
CreateParameterFromManagedExpression()returns anExpression, butCreateReturnValueFromManagedExpression()doesn't use that return value. Why doesn't it? In retrospect, I think it would make more sense ifCreateReturnValueFromManagedExpression()did:That way, the return value isn't entirely ignored, instead of using a "+
_ref" suffix logic to lookup a variable created elsewhere. The current code seems ugly.[Java.Interop] Do not dispose live references on return to JNI
[Java.Interop] Do not dispose live references on return to JNI
[Java.Interop] Do not dispose live references on return to JNI
Bump to xamarin/Java.Interop/master@8ee34a35
Bump to xamarin/Java.Interop/master@8ee34a35 (#2286)
[Java.Interop] Do not dispose live references on return to JNI