In a ListBox where the ItemTemplate has a Grid containing a SharedSizeGroup (the ListBox itself has IsSharedSizeScope=true), after filling the list with random sized items, resizing the window or scrolling results in a 'Infinite layout loop detected' crash (fails about 50% of the time)
To Reproduce
Compile and run the following project on Windows 11.
Press fill list button
now start resizing the window in a counterclockwise circular motion, or scroll the list content randomly
now you'll see debug messages like [Layout]Layout cycle detected. Item 'Avalonia.Controls.Grid' was enqueued '10' times.
eventually it will result in a System.InvalidOperationException: 'Infinite layout loop detected'
Describe the bug
In a ListBox where the ItemTemplate has a Grid containing a SharedSizeGroup (the ListBox itself has IsSharedSizeScope=true), after filling the list with random sized items, resizing the window or scrolling results in a 'Infinite layout loop detected' crash (fails about 50% of the time)
To Reproduce
[Layout]Layout cycle detected. Item 'Avalonia.Controls.Grid' was enqueued '10' times.
System.InvalidOperationException: 'Infinite layout loop detected'
layoutlooprepro.zip
repro also available here: https://github.com/jpmikkers/AvaHash/tree/crashrepro
Expected behavior
No crash. Note that Avalonia 11.0.x did not show this issue.
Avalonia version
11.1.0, 11.1.1, 11.1.2, 11.1.3, 11.2.999-cibuild0051600-alpha, 11.1.4
OS
Windows, Linux (raspbian on rpi4)
Additional context
https://github.com/user-attachments/assets/a9b840d4-db01-4909-9a58-1474538765a3