Bug 43154 - Clearing CarouselPage ItemSource creates phantom item
Summary: Clearing CarouselPage ItemSource creates phantom item
Status: CONFIRMED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.1
Hardware: PC Windows
: Normal major
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-08-07 19:02 UTC by fiyahuluw
Modified: 2016-08-10 00:06 UTC (History)
3 users (show)

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


Attachments
Scrolling past the last item in android emulator (179.67 KB, image/png)
2016-08-07 19:02 UTC, fiyahuluw
Details


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 43154 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:
Status:
CONFIRMED

Description fiyahuluw 2016-08-07 19:02:22 UTC
Created attachment 16936 [details]
Scrolling past the last item in android emulator

Clearing CarouselPage ItemSource then adding items causes a 'phantom' item to appear at the end of the CarouselPage that crashes the application when navigated to.

I encountered this bug on android and have not tested it on any other platforms.

Steps to reproduce:

1. Bind the ItemSource of a CarouselPage to an ObservableCollection<T>.

2. Be sure to populate the collection with at least one item before it is rendered to prevent a no items exception.

Within the same method:

3. Clear the collection with ObservableCollection<T>.Clear().

4. Populate the collection with new items.

Getting the error:

5. Scroll through the carousel until you get to the last real item. If you scroll just a bit further you will notice an extra empty page (the phantom item). Should you release the CarouselPage over this item it will attempt to select it and crash.
Comment 1 fiyahuluw 2016-08-07 19:37:58 UTC
Update:

The author of this thread appears to be having the same issue and has found a workaround: https://forums.xamarin.com/discussion/67490/xamarin-carousel-page-throws-system-argumentoutofrangeexception-on-last-page-swipe-only-on-android