Bug 54667 - Changing the itemsource of a ListView to a smaller collection may throw an exception
Summary: Changing the itemsource of a ListView to a smaller collection may throw an ex...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
Depends on:
Reported: 2017-04-06 19:53 UTC by thomas
Modified: 2017-06-07 18:44 UTC (History)
2 users (show)

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 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.

Related Links:

Description thomas 2017-04-06 19:53:22 UTC
If I assign a ListView a new itemsource with less items than the last one and the ListView was scrolled let's say down to item 91 the new collection has only 50 it will request item 91 from the new collection and crash.

Not sure if it is important in my case both itemsources requested different DataTemplates via a TemplateSelector.

I would expect when you assign a new Itemsource that the ListView returns to the first Element of the new source.
Comment 1 Jimmy [MSFT] 2017-04-06 22:29:39 UTC
Hey Thomas, I wasn't able to reproduce this crash in a new project or with the DataTemplate sample[1]. It worked on Forms and and on all Android, iOS, and UWP.

Did the crash begin with 2.3.4? What platform are you experiencing this on? Please attach a repro project and we will look into it further. Thanks!

[1] https://developer.xamarin.com/samples/xamarin-forms/templates/datatemplateselector/
Comment 2 thomas 2017-04-07 10:50:21 UTC
Hi Jimmy,

I wil try to snd you a stripped version of our App beginning next week.

Comment 3 Jimmy [MSFT] 2017-06-07 18:44:01 UTC
Hey Thomas, since we haven't received a follow up in over 4 weeks, I'm going to go ahead and close this. However if you're able to create a repro for this using Forms or newer, please reopen the ticket and attach the project so we can continue looking into this. Thanks!