Bug 40513 - Adding views to CarouselView after rendered and swiping crashes Forms v.2.2.0.5
Summary: Adding views to CarouselView after rendered and swiping crashes Forms v.2.2.0.5
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.2.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-04-19 09:27 UTC by FieldstrikeMobile
Modified: 2016-06-02 07:40 UTC (History)
3 users (show)

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


Attachments
Repo Case (321.43 KB, application/zip)
2016-04-19 09:27 UTC, FieldstrikeMobile
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 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:
Status:
RESOLVED FIXED

Description FieldstrikeMobile 2016-04-19 09:27:15 UTC
Created attachment 15763 [details]
Repo Case

I have attached a small sample. ( I have only tested on Android so far)

The sample contains a carouselview with 10 views and a button at the top which adds pages to the start of the observable collection like so:

    Items.Insert(0, string.Format("New page {0}", i));

Steps to reproduce this bug.

1. Start the application.
2. Click the "Add Page" button 3 times
3. Swipe to the left twice (so that you end up on the "string 2" page)
4. crash.

Exception:

04-19 10:21:53.212 I/MonoDroid(16090): UNHANDLED EXCEPTION:
04-19 10:21:53.217 I/MonoDroid(16090): System.InvalidOperationException: Sequence contains more than one element
04-19 10:21:53.217 I/MonoDroid(16090):   at System.Linq.Enumerable.Single[TSource] (IEnumerable`1 source) [0x0008e] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/System.Core/System/Linq/Enumerable.cs:1050 
04-19 10:21:53.217 I/MonoDroid(16090):   at Xamarin.Forms.Platform.Android.CarouselViewRenderer+<>c__DisplayClass8_0.<Initialize>b__5 (Int32 disappearingPosition) [0x00021] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Renderers\CarouselViewRenderer.cs:493 
04-19 10:21:53.217 I/MonoDroid(16090):   at Xamarin.Forms.Platform.Android.PhysicalLayoutManager.OnAppearingOrDisappearing (Int32 position, Boolean isAppearing) [0x0004b] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Renderers\CarouselViewRenderer.cs:842 
04-19 10:21:53.217 I/MonoDroid(16090):   at Xamarin.Forms.Platform.Android.PhysicalLayoutManager.OnLayoutChildren (Android.Support.V7.Widget.Recycler recycler, Android.Support.V7.Widget.State state) [0x000ef] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Renderers\CarouselViewRenderer.cs:1073 
04-19 10:21:53.217 I/MonoDroid(16090):   at Xamarin.Forms.Platform.Android.PhysicalLayoutManager.ScrollBy (Xamarin.Forms.Platform.Android.IntVector& delta, Android.Support.V7.Widget.Recycler recycler, Android.Support.V7.Widget.State state) [0x0007d] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Renderers\CarouselViewRenderer.cs:825 
04-19 10:21:53.217 I/MonoDroid(16090):   at Xamarin.Forms.Platform.Android.PhysicalLayoutManager.ScrollHorizontallyBy (Int32 dx, Android.Support.V7.Widget.Recycler recycler, Android.Support.V7.Widget.State state) [0x00009] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Renderers\CarouselViewRenderer.cs:1128 
04-19 10:21:53.217 I/MonoDroid(16090):   at Android.Support.V7.Widget.RecyclerView+LayoutManager.n_ScrollHorizontallyBy_ILandroid_support_v7_widget_RecyclerView_Recycler_Landroid_support_v7_widget_RecyclerView_State_ (IntPtr jnienv, IntPtr native__this, Int32 dx, IntPtr native_recycler, IntPtr native_state) [0x0001a] in <filename unknown>:0 
04-19 10:21:53.217 I/MonoDroid(16090):   at (wrapper dynamic-method) System.Object:23377f6f-6d85-4994-8b7b-6e969eb10f4a (intptr,intptr,int,intptr,intptr)
Comment 1 Chris King 2016-06-01 23:40:48 UTC
Android reported scroll idle when actually settling.
Comment 2 FieldstrikeMobile 2016-06-02 07:40:10 UTC
@ChrisKing which version of Xamarin Forms is this fixed for? so I can verify it has been fixed