dotnet / dotnet/maui

[Android] ArgumentOutOfRangeException Occurs with KeepLastItemInView for Grouped List

Open
#29,153 1 comment 0 reactions 0 assignees View on GitHub
area-controls-collectionview partner/syncfusion platform/android s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

When using KeepLastItemInView in a CollectionView with a grouped list , an ArgumentOutOfRangeException is thrown. This issue occurs when adding a new item from top.

Image

### Steps to Reproduce

1. Run the attached sample [ItemsUpdatingScrollModeIssue 3.zip](https://github.com/user-attachments/files/19869454/ItemsUpdatingScrollModeIssue.3.zip)
2. Select KeepLastItemInView and add new item observe that it throws an ArgumentOutOfRangeException.

Expected Behavior:

- The CollectionView should automatically scroll to the last item in the group without throwing an exception.

Actual Behavior:

- An ArgumentOutOfRangeException is thrown with the message: 'Index was out of range. Must be non-negative and less than the size of the collection.'

### Link to public reproduction project repository

_No response_

### Version with bug

9.0.60 SR6

### Is this a regression from previous behavior?

Not sure, did not test other versions

### Last version that worked well

_No response_

### Affected platforms

Android

### Affected platform versions

_No response_

### Did you find any workaround?

_No response_

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start by running the attached ItemsUpdatingScrollModeIssue 3.zip sample on Android and reproduce the exception with KeepLastItemInView, a grouped CollectionView, and an item added from the top. Trace the grouped-list update and scrolling path; done means adding the item scrolls to the last item in its group without an ArgumentOutOfRangeException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.