Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
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.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I've isolated what I think is a bug running on KitKat. It seems *not* to crash in a simulator, strangely
Latest Stable of Xamarin.Forms, currently 220.127.116.11
I'm using a Xamarin forms listview, bound via XAML to a grouped collection.
I've found that if I update the collection directly I get the following error.
12-13 12:24:04.265 D/Mono (20087): Found as 'java_interop_jnienv_throw'.
12-13 12:24:04.275 W/dalvikvm(20087): JNI WARNING: JNI function CallObjectMethodA called with exception pending
12-13 12:24:04.275 W/dalvikvm(20087): in Lmd5b60ffeb829f638581ab2bb9b1a7f4f3f/ListViewAdapter;.n_getCount:()I (CallObjectMethodA)
12-13 12:24:04.275 W/dalvikvm(20087): Pending exception is:
12-13 12:24:04.275 I/dalvikvm(20087): android.runtime.JavaProxyThrowable: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
12-13 12:24:04.275 I/dalvikvm(20087): Parameter name: index
12-13 12:24:04.275 I/dalvikvm(20087): at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00000] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/referencesource/mscorlib/system/throwhelper.cs:93
12-13 12:24:04.275 I/dalvikvm(20087): at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/referencesource/mscorlib/system/throwhelper.cs:56
12-13 12:24:04.275 I/dalvikvm(20087): at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x0000c] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/referencesource/mscorlib/system/collections/generic/list.cs:181
12-13 12:24:04.275 I/dalvikvm(20087): at Cadenza.Collections.OrderedDictionary`2[TKey,TValue].get_Item (System.Int32 index) [0x00000] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Core\OrderedDictionary.cs:101
12-13 12:24:04.275 I/dalvikvm(20087): at Xa
12-13 12:24:04.275 I/dalvikvm(20087): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ListViewAdapter.n_getCount(Native Method)
12-13 12:24:04.275 I/dalvikvm(20087): at md5b60ffeb829f638581ab2bb9b1a7f4f3f.ListViewAdapter.getCount(ListViewAdapter.java:44)
12-13 12:24:04.275 I/dalvikvm(20087): at android.widget.HeaderViewListAdapter.getCount(HeaderViewListAdapter.java:132)
As a hack-around, I've found that if I first re-initialise it, and then nest the update inside
Device.StartTimer(new TimeSpan(0), () =>
Then the app won't crash. The downside is that you get an ugly flash of no data in the listview during the update.
I've created an app to demonstrate the issue with a switch at the top to toggle what i've called "Race Condition Protection". Load more customers on a KitKat phone without this enabled and you'll get the above bug.
Funnily enough though, after you've loaded more customers using the race condition protection: Then you can turn it off and it'll work fine without the protection.
Steps to reproduce:
1) Use a phone running KitKat.
2) Fire up the attached project
3) without pressing the "Use Race Condition Protection" switch, click "Load more customers"
1) Fire up the attached project
2) Press the "Use Race Condition Protection" switch
3) Click "Load more customers"
4) No Crash.
5) Remove "Use Race Condition Protection"
6) Click "Load more customers"
7) No Crash.
Looks like my attachment didn't upload. I made another one, which crashes slightly differently. This one isn't as predictable, you can't just use the timer once and be okay: This one will continue to crash unpredicably on KitKat devices.
@Richard Long: Can you try uploading your project again? Please omit the packages folder and the bin/obj folders to reduce the file size. Thanks!!
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!