microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

Nested ObservableCollection crashes when removing item

Open WillyWoe opened this issue 1 year ago • 1 comments

Describe the bug

When removing an item in a nested ObservableCollection, tha app crashes with System.ArgumentOutOfRangeException: 'This collection cannot work with indices larger than Int32.MaxValue - 1 (0x7FFFFFFF - 1). (Parameter 'index')'

I attached a small example that reproduces the bug Example.zip

the example consists of 2 ItemsView, one represents the headers and the second represents the details of the selected header.

Steps to reproduce the bug

  1. Click on Add Header
  2. Select Header 0
  3. Click on Add Detail
  4. Click on Add Detail again
  5. Select Detail 1
  6. Click on Remove Detail
  7. Select Detail 0
  8. Click on Remove Detail
  9. App crashes

https://github.com/user-attachments/assets/e4df17e2-9260-4336-bfb6-1a04c1cd54e8

Expected behavior

App does not crash when an item is removed

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5.5: 1.5.240627000

Windows version

Windows 11 (22H2): Build 22621, Windows 10 (20H2): Build 19042

Additional context

No response

WillyWoe avatar Aug 01 '24 19:08 WillyWoe

This was closed as duplicate of an active internal bug. Reactivating and connecting to that bug.

codendone avatar Aug 29 '24 03:08 codendone

it also in 1.7-preview1,reproduce: click button1 add item1, click button2 to add item2 and remove item1 in code, will crash.

Image

bluelaze avatar Feb 13 '25 16:02 bluelaze