Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] Scrolling CollectionView(with footer) to the last item throws System.ArgumentOutOfRangeException #7121

Closed
BartoszKopec opened this issue Aug 9, 2019 · 3 comments · Fixed by #7199
Assignees
Labels
Projects

Comments

@BartoszKopec
Copy link

Description

CollectionView, when vertical scrolling to the last item by developer in Android emulator, throws an System.ArgumentOutOfRangeException:
'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index'

Steps to Reproduce

  1. Using MVVM and Xamarin.Forms 4.2.0.673161-pre3
  2. ContentPage with ContentView (with ControlTemplate in it)
  3. CollectionView in ContentView
  4. Some items in ItemsSource (MVVM)

Expected Behavior

Not throwing an exception and correct using of Scrolled event

Actual Behavior

Throws an exception System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index'

Basic Information

  • Version with issue: Xamarin.Forms 4.2.0.673161-pre3
  • Last known good version: Xamarin.Forms 4.1
  • IDE: Visual Studio 2019 Community 16.2.1
  • Platform Target Frameworks:
    • iOS:
    • Android: 9.0
    • UWP:
  • Android Support Library Version: 28.0.0.1
  • Nuget Packages:
  • Affected Devices:

Screenshots

Reproduction Link

@BartoszKopec BartoszKopec added s/unverified New report that has yet to be verified t/bug 🐛 labels Aug 9, 2019
@pauldipietro pauldipietro added this to New in Triage Aug 9, 2019
@jfversluis
Copy link
Member

Would it be possible to add a reproduction project so we can see what is going on?

Thanks!

@jfversluis jfversluis added a/collectionview p/Android s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. labels Aug 10, 2019
@BartoszKopec
Copy link
Author

BartoszKopec commented Aug 10, 2019

Would it be possible to add a reproduction project so we can see what is going on?

Thanks!

Reproduction project is here: https://github.com/BartoszKopec/ReproductionMobile
I found that the exception is when CollectionView has a footer just like in reproduction.
It is in MainPage.xaml (line 66) here
When there isn't footer, scrolling works very well.

@BartoszKopec BartoszKopec changed the title [Bug] Scrolling CollectionView to the last throws System.ArgumentOutOfRangeException [Bug] Scrolling CollectionView(with footer) to the last item throws System.ArgumentOutOfRangeException Aug 10, 2019
@hartez hartez self-assigned this Aug 10, 2019
@hartez
Copy link
Contributor

hartez commented Aug 10, 2019

I'm betting this is another aspect of #7102.

@jfversluis jfversluis removed the s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. label Aug 12, 2019
@PureWeen PureWeen moved this from New to Ready For Work in Triage Aug 15, 2019
@samhouts samhouts moved this from Ready For Work to Needs Estimate in Triage Aug 16, 2019
@samhouts samhouts added this to In Progress in v4.2.0 Aug 18, 2019
@samhouts samhouts removed this from Needs Estimate in Triage Aug 18, 2019
@samhouts samhouts added this to In Progress in v4.3.0 Aug 22, 2019
@samhouts samhouts removed this from In Progress in v4.2.0 Aug 22, 2019
@samhouts samhouts added this to Backlog in CollectionView Aug 27, 2019
v4.3.0 automation moved this from In Progress to Done Aug 28, 2019
CollectionView automation moved this from Backlog to Done Aug 28, 2019
samhouts pushed a commit that referenced this issue Aug 28, 2019
* Move all the header/footer adjustment to IItemsViewSource
fixes #7121
fixes #7102
partially implements #3172
fixes #7243

* Fix selection bugs introduced by header/footer on Android

* Implement grouping for CollectionView on Android

* Enable grouping tests for Android

* Naming and comment cleanup

* Update Xamarin.Forms.Platform.Android/CollectionView/ListSource.cs

Co-Authored-By: Gerald Versluis <gerald.versluis@microsoft.com>

* Update Xamarin.Forms.Platform.Android/CollectionView/ObservableGroupedSource.cs
@samhouts samhouts added this to In Progress in v4.4.0 Aug 30, 2019
@samhouts samhouts moved this from In Progress to Done in v4.4.0 Aug 30, 2019
@samhouts samhouts removed this from Done in v4.3.0 Sep 3, 2019
@samhouts samhouts removed this from Done in v4.4.0 Sep 11, 2019
@samhouts samhouts added this to In Progress in v4.3.0 Sep 11, 2019
@samhouts samhouts moved this from In Progress to Done in v4.3.0 Sep 11, 2019
felipebaltazar pushed a commit to felipebaltazar/Xamarin.Forms that referenced this issue Oct 16, 2019
* Move all the header/footer adjustment to IItemsViewSource
fixes xamarin#7121
fixes xamarin#7102
partially implements xamarin#3172
fixes xamarin#7243

* Fix selection bugs introduced by header/footer on Android

* Implement grouping for CollectionView on Android

* Enable grouping tests for Android

* Naming and comment cleanup

* Update Xamarin.Forms.Platform.Android/CollectionView/ListSource.cs

Co-Authored-By: Gerald Versluis <gerald.versluis@microsoft.com>

* Update Xamarin.Forms.Platform.Android/CollectionView/ObservableGroupedSource.cs
felipebaltazar pushed a commit to felipebaltazar/Xamarin.Forms that referenced this issue Oct 16, 2019
* Move all the header/footer adjustment to IItemsViewSource
fixes xamarin#7121
fixes xamarin#7102
partially implements xamarin#3172
fixes xamarin#7243

* Fix selection bugs introduced by header/footer on Android

* Implement grouping for CollectionView on Android

* Enable grouping tests for Android

* Naming and comment cleanup

* Update Xamarin.Forms.Platform.Android/CollectionView/ListSource.cs

Co-Authored-By: Gerald Versluis <gerald.versluis@microsoft.com>

* Update Xamarin.Forms.Platform.Android/CollectionView/ObservableGroupedSource.cs
@samhouts samhouts removed this from Done in CollectionView May 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
No open projects
v4.3.0
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants