AndreiMisiukevich / CardView

CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms
MIT License
710 stars 114 forks source link

System.ArgumentOutOfRangeException #350

Closed angelru closed 4 years ago

angelru commented 4 years ago

this component has the same error as xamarin ... any solution?

https://github.com/xamarin/Xamarin.Forms/issues/10865

AndreiMisiukevich commented 4 years ago

this component has the same error as xamarin ... any solution?

xamarin/Xamarin.Forms#10865

please provide a sample. I cannot reproduce that

angelru commented 4 years ago

just add an item to the ObservableCollection, delete and then add another, the problem is when there are 0 items

AndreiMisiukevich commented 4 years ago

just add an item to the ObservableCollection, delete and then add another, the problem is when there are 0 items

So, the test case

1) Exists 1 item in CarouselView 2) I remove this item (Exists 1) 3) I add a new one - crash

Right?

angelru commented 4 years ago

Right

AndreiMisiukevich commented 4 years ago

Right

Just tried. Cannot reproduce on iOS iPhone 11 Simulator.

AndreiMisiukevich commented 4 years ago

Here is the stack trace, when I used XF carousel.

And I CANNOT reproduce with the same steps with PanCardView.CarouselView. Are you sure you used mine one?

  at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs:161 
  at System.Collections.ObjectModel.Collection`1[T].System.Collections.IList.get_Item (System.Int32 index) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs:266 
  at Xamarin.Forms.Platform.Android.ObservableItemsSource.ElementAt (System.Int32 index) [0x0000f] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ObservableItemsSource.cs:223 
  at Xamarin.Forms.Platform.Android.ObservableItemsSource.GetItem (System.Int32 position) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ObservableItemsSource.cs:59 
  at Xamarin.Forms.Platform.Android.CarouselViewRenderer.SetCurrentItem (System.Int32 carouselPosition) [0x00043] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\CarouselViewRenderer.cs:394 
  at Xamarin.Forms.Platform.Android.CarouselViewRenderer.CollectionItemsSourceChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x000bc] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\CarouselViewRenderer.cs:256 
  at Xamarin.Forms.Platform.Android.ObservableItemsSource.CollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs args) [0x0005a] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ObservableItemsSource.cs:122 
  at Xamarin.Forms.Platform.Android.ObservableItemsSource.CollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs args) [0x0002d] in D:\a\1\s\Xamarin.Forms.Platform.Android\CollectionView\ObservableItemsSource.cs:95 
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00018] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:263 
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:338 
  at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x0001a] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:196 
  at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs:71 
  at PanCardViewSample.ViewModels.CardsSampleViewModel.<.ctor>b__5_3 () [0x00001] in /Users/andrei/Desktop/cards/PanCardViewSample/PanCardViewSample/ViewModels/CardsSampleViewModel.cs:61 
  at Xamarin.Forms.Command+<>c__DisplayClass4_0.<.ctor>b__0 (System.Object o) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Command.cs:74 
  at Xamarin.Forms.Command.Execute (System.Object parameter) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Command.cs:112 
  at Xamarin.Forms.ButtonElement.ElementClicked (Xamarin.Forms.VisualElement visualElement, Xamarin.Forms.Internals.IButtonElement ButtonElementManager) [0x00008] in D:\a\1\s\Xamarin.Forms.Core\ButtonElement.cs:60 
  at Xamarin.Forms.Button.SendClicked () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Button.cs:171 
  at Xamarin.Forms.Platform.Android.ButtonElementManager.OnClick (Xamarin.Forms.VisualElement element, Xamarin.Forms.IButtonController buttonController, Android.Views.View v) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\ButtonElementManager.cs:25 
  at Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer.Android.Views.View.IOnClickListener.OnClick (Android.Views.View v) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\FastRenderers\ButtonRenderer.cs:77 
  at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_v) [0x0000f] in <55654ebe9f2a48e6bade2862bb243f94>:0 
  at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.27(intptr,intptr,intptr)
angelru commented 4 years ago

XF carousel, did you get the exception? I'm sure I used yours too

AndreiMisiukevich commented 4 years ago

XF carousel, did you get the exception? I'm sure I used yours too

No, I tried to reproduce with no luck (XF crashes, Mine -- not). Can you create a small sample?

AndreiMisiukevich commented 4 years ago

XF carousel, did you get the exception? I'm sure I used yours too

?

angelru commented 4 years ago

did you try on android?

AndreiMisiukevich commented 4 years ago

did you try on android?

Yes, I did. So can you provide a sample?

angelru commented 4 years ago

I just tried a new project and it works well, I don't know what happened, sorry for the annoying and I close the topic

AndreiMisiukevich commented 4 years ago

I just tried a new project and it works well, I don't know what happened, sorry for the annoying and I close the topic

no problem