microsoft / microsoft/microsoft-ui-xaml
ArgumentOutOfRange exception when scrolling ItemRepeater with images too fast
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
I have an ItemsRepeater and attached to it is an AnnotatedScrollBar. When I scroll up and down pretty fast. The whole app crashes and throws the "System.ArgumentOutOfRangeException" in WinRT.Runtime.dll
I have only tested with images. Maybe it happens even with something else, but images are my main thing to show there so that's what I tested for.
As you can also see in the video, when I start scrolling everything works, it's not even a problem, that the images do not render directly. I guess it's normal due to the virtualization. The problem appears after some time, when the app starts with the loading cursor and becomes completely unresponsive.
### Steps to reproduce the bug
```xml
```
```cs
private void annotatedScrollBar_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
imageItemRepeaterScroller.ScrollPresenter.VerticalScrollController = annotatedScrollBar.ScrollController;
}
//load some images:
var images = Directory.GetFiles("C:\\Users\\MYUSER\\Pictures\\Screenshots");
var items = new ObservableCollection(images);
imageRenderer.ItemsSource = items;
```
Now launch the app, you should see a list of 200 screenshots. Hope you have, otherwise maybe select a different folder. Now start scrolling really fast up and down using the annotatedScrollBar and at some point the app will crash with a "System.ArgumentOutOfRangeException" in WinRT.Runtime.dll exception.
### Expected behavior
I don't want it to crash. There is no problem if it loads or shows nothing for a short time, but a crash is
inappropriate.
### Screenshots
https://github.com/user-attachments/assets/f5ecc5a6-5ea0-48a4-ae57-741e5d8d217f
### NuGet package version
WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003
### Windows version
Windows 11 (24H2): Build 26100
### Additional context
_No response_
Contributor guide
Research direction
Start by running the provided ItemsRepeater, LinedFlowLayout, ScrollView, and AnnotatedScrollBar reproduction with about 200 images, then capture the complete exception stack beyond WinRT.Runtime.dll. Investigate the rapid-scroll path and verify that repeated scrolling no longer crashes or leaves the app unresponsive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100