Created attachment 18571 [details]
Android monitor log
I use a JavaList<> as data for my RecyclerView. The app works normally, but from a recent update the app crash with this error:
System.ArgumentException: Handle must be valid.
Parameter name: instance
This happen when I use with the JavaList (method doesn't matter, can be Count, , etc).
In Android Monitor i get this additional information:
at Java.Interop.JniEnvironment+InstanceMethods.CallIntMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x0000d] in <a043032cf94a485190047a14918b9f60>:0
I attach the entire log I got from Android Monitor
Dude, it's a serious bug. I can confirm because now it happen in another app! Ask for detail, but fix it!
I try to downgrade Xamarin to the last version of Cycle 7. It works.
The problem it happens only with version 8.
@contatti: Xamarin.Android 7.0 ("Cycle 8") changed the default bridge from "old" to "tarjan". Please try using the "old" implementation:
If that fixes the issue, you found a GC bridge bug. (Yay?) If possible, please attach a test case so that our GC team can fix it.
I try your suggest and it works!
I will create a test case on next monday, however I can tell you I use the object JavaList<> as data inside a Android.Support.V4.App.Fragment
I try to create a test case, but I am unable to reproduce the bug.
Maybe we can try with a full app?
@contatti: If you can provide the full app and repro instructions, that would be fine.
Do we have an update on this?
It seems now fixed. Apologize me for lack of updates, but my job keep me very busy.
Unfortunately after an extensive test the problem still appear.
In these days I do not have much time, I try to recreate the problem in a sample with no success.
I am seeing a very similar thing so maybe this info will help.
I have a custom layout I am using with an adapter. This layout and a ViewDragHelper and a GestureDetectorCompat as member variables that are created in OnFinishInflate().
While running the app and testing app bar action mode I get the below output in the application output that appears to be a GC run. After than runs, the Java.Lang.Object of both of these classes have been disposed. The debugger tells me that when I get the System.ArgumentException. I am dead in the water once the GC runs.
[art] Starting a blocking GC Explicit
[art] Explicit concurrent mark sweep GC freed 8269(934KB) AllocSpace objects, 3(80KB) LOS objects, 40% free, 7MB/12MB, paused 545us total 33.815ms
[Mono] GC_TAR_BRIDGE bridges 948 objects 1387 opaque 526 colors 927 colors-bridged 914 colors-visible 914 xref 469 cache-hit 0 cache-semihit 0 cache-miss 13 setup 0.18ms tarjan 1.81ms scc-setup 0.41ms gather-xref 0.09ms xref-setup 0.02ms cleanup 0.22ms
[Mono] GC_BRIDGE: Complete, was running for 61.92ms
[Mono] GC_MINOR: (Nursery full) time 20.14ms, stw 21.13ms promoted 679K major size: 1536K in use: 858K los size: 2048K in use: 1695K
I just tested with "MONO_GC_PARAMS=bridge-implementation=old" environment variable set and cannot reproduce my issue. Before I try to put together a test project to reproduce this issue, is this something that you need or is this issue understood?
> is this something that you need or is this issue understood
Yes. Please oh please oh please yes, we would *love* to have a test project. We have not been able to create a repro, and haven't found any other sources for a repro.
Marking as a duplicate of Bug #56902 as Bug #56902 contains a repro project (yay!) and expresses the same bug behaviors.
*** This bug has been marked as a duplicate of bug 56902 ***
Notice (2018-05-21): bugzilla.xamarin.com will be
switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.
Please join us on
Visual Studio Developer Community and
GitHub to continue tracking
issues. Bugzilla will remain available for reference in read-only mode.
We will continue to work on open Bugzilla bugs and copy them to the new
locations as needed for follow-up. The See Also field
on each Bugzilla bug will be updated with a link to its new location
After Bugzilla is read-only, if you have new information to add for a
bug that does not yet have a matching issue on Developer Community or
GitHub, you can create a follow-up issue in the new location. Copy and
paste the title and description from this bug, and then add your new
details. You can get a pre-formatted version of the title and
In special cases you might also want the comments:
Our sincere thanks to everyone who has contributed on this bug tracker
over the years. Thanks also for your understanding as we make these
adjustments and improvements for the future.