Open nziosys opened 3 years ago
@nziosys can you attach a small project reproducing the issue please?
@PureWeen I attached very simple example. CarouselTest.zip
While creating it I found out some very crazy behaviour, that makes me doubt logic and computers at all ^^
`// this fails UpdateCollectionCommand = new Command(() => { Items[1] = "Item 4"; Items.RemoveAt(0); });
// this works UpdateCollectionCommand = new Command(() => { var toEdit = Items[1]; toEdit = "Item 4"; Items.RemoveAt(0); });`
Best regards
Description
I know, this is very specific case, but it disables me implementing my specific app logic. The app crashes (System.ArgumentOutOfRangeException) if you scroll to the end of the carouselView and than change an element of the bound observable collection and remove another. All these conditions need to be fullfiled to get that Bug and exception. The scenario is - the user scrolls through the carousel and new data is comming from the server, so I need to remove, change and add some items. Concider that is works on iOS, it also works if you only remove or only change items, and even both but not scrolled to the end.
So it basicaly crashes if you remove more elements than the left behind the current item (and you changed any). This means, if you scroll to the end and remove one, or if you scroll to (end-1) and remove two and so on.
Steps to Reproduce
Expected Behavior
A is removed, B is changed to D C remains as it is, and remains currentItem
Actual Behavior
App crash. System.ArgumentOutOfRangeException
Basic Information
Android simulator - Android 10.0 API 29 Xamarin.Forms 5.0.0.2012
Workarround
The workaround that I realy don't like to use is add an small delay between the update and delete. This probably gives the carousel time enough to recalculate something, so it doesn't crash.