Bug 60952 - RecycleElement Exception On Listview
Summary: RecycleElement Exception On Listview
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.5.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-12-02 00:42 UTC by Hakan
Modified: 2017-12-14 16:14 UTC (History)
3 users (show)

Tags: needs_repro
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 for Bug 60952 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Hakan 2017-12-02 00:42:43 UTC
I have a listview with 100 rows that contain labels. Some all are one line labels except the 20th. which is a two line label. Listview's HasUnevenRows property is true. When I use caching strategy as "RecycleElement", on iOS, I get the following exception, but only when I scroll fast. Scrolling very slowly does not cause the error:

System.Exception: CurrentDomainOnUnhandledException ---> Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSRangeException Reason: *** -[__NSArrayM objectAtIndex:]: index 7 beyond bounds [0 .. 6]

Xamarin.Forms.Platform.iOS.ListViewRenderer.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:298 

 at Xamarin.Forms.Platform.iOS.ListViewRenderer.UpdateItems (System.Collections.Specialized.NotifyCollectionChangedEventArgs e, System.Int32 section, System.Boolean resetWhenGrouped) [0x00106] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:533
Comment 1 Hakan 2017-12-02 00:45:16 UTC
One other thing I forgot to mention: I add a row as user scrolls down and this exception is caused by this addition process.
Comment 2 Hakan 2017-12-02 01:09:10 UTC
One other artifact I noticed is that as new rows are added, the first new row will have the binding context of the last old row. When you scroll it out of the screen and scroll it back into the screen again, it gets the right binding. And sometimes the two rows are positioned on top of each other etc. There is also this bug that is related to binding context anomaly: Bug 44525.
Comment 3 Paul DiPietro [MSFT] 2017-12-04 05:16:53 UTC
As we usually ask with reports, can you give us a reproduction so we see exactly what your code is doing? Are you only getting this issue on specific devices (or only devices vs sims), iOS versions, etc.? Is this a regression on a previous version or a long-standing behavior?

General reproduction submitting guidelines are available here: