Bug 40696 - Cannot add items to start of CarouselView dynamically and Scroll
Summary: Cannot add items to start of CarouselView dynamically and Scroll
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.2.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Chris King
URL:
Depends on:
Blocks:
 
Reported: 2016-04-26 08:46 UTC by FieldstrikeMobile
Modified: 2017-05-05 17:36 UTC (History)
3 users (show)

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


Attachments
Repo Case (312.58 KB, application/zip)
2016-04-26 08:46 UTC, FieldstrikeMobile
Details
Updated Repo to use seperate CarouselView Nuget (328.30 KB, application/x-zip-compressed)
2016-07-28 08:08 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 NOT_ON_ROADMAP

Description FieldstrikeMobile 2016-04-26 08:46:54 UTC
Created attachment 15843 [details]
Repo Case

I have a CarouselView full of dates which I am testing on Android. which I am looking to fill dynamically for obvious reasons.

I am bound to the position which when it reaches position 1 triggers a method to add items to the front of the bound itemssource.

Doing this causes the following error:
04-26 09:41:16.107 I/MonoDroid(13712): UNHANDLED EXCEPTION:
04-26 09:41:16.117 I/MonoDroid(13712): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Java.Lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
04-26 09:41:16.117 I/MonoDroid(13712):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
04-26 09:41:16.117 I/MonoDroid(13712):   at Android.Runtime.JNIEnv.CallVoidMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00063] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:571 
04-26 09:41:16.117 I/MonoDroid(13712):   at Android.Support.V7.Widget.RecyclerView+Adapter.NotifyItemRangeInserted (Int32 positionStart, Int32 itemCount) [0x0005d] in <filename unknown>:0 
04-26 09:41:16.117 I/MonoDroid(13712):   at Xamarin.Forms.Platform.Android.CarouselViewRenderer.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00026] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Renderers\CarouselViewRenderer.cs:514 
04-26 09:41:16.117 I/MonoDroid(13712):   at Xamarin.Forms.ItemsView.OnCollectionChange (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\ItemsViewSimple.cs:102 
04-26 09:41:16.117 I/MonoDroid(13712):   at Xamarin.Forms.ItemsView+WeakNotifyCollectionChanged.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00027] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\ItemsViewSimple.cs:127 
04-26 09:41:16.117 I/MonoDroid(13712):   at Xamarin.Forms.ItemsView+ItemSource+<>c__DisplayClass16_0.<OnCollectionChanged>b__0 () [0x0000d] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\ItemsViewSimple.cs:197 
04-26 09:41:16.117 I/MonoDroid(13712):   at Xamarin.Forms.ItemsView+ItemSource.OnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00068] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\ItemsViewSimple.cs:211 
04-26 09:41:16.117 I/MonoDroid(13712):   at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00012] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:286 
04-26 09:41:16.117 I/MonoDroid(13712):   at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (NotifyCollectionChangedAction action, System.Object item, Int32 index) [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:349 
04-26 09:41:16.117 I/MonoDroid(13712):   at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (Int32 index, System.Collections.ObjectModel.T item) [0x00024] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:217 
04-26 09:41:16.117 I/MonoDroid(13712):   at System.Collections.ObjectModel.Collection`1[T].Insert (Int32 index, System.Collections.ObjectModel.T item) [0x00038] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/collections/objectmodel/collection.cs:124 
04-26 09:41:16.117 I/MonoDroid(13712):   at CarouselTest2.MainViewModel.AddExtraDaysToList (DateTime date, Boolean addToStart) [0x00069] in C:\Users\jameskennedy\Documents\Visual Studio 2015\Projects\CarouselTest2\CarouselTest2\CarouselTest2\MainViewModel.cs:50 


Steps to replicate:

1. Run the sample project
2. scroll 8 times to the left
3. method to add is triggered and crashes
Comment 1 FieldstrikeMobile 2016-07-28 08:08:38 UTC
Created attachment 16806 [details]
Updated Repo to use seperate CarouselView Nuget
Comment 2 Chris King 2017-05-05 17:36:35 UTC
CarouselView to be deprecated and replaced with https://github.com/xamarin/Xamarin.Forms/pull/853