AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
24.82k stars 2.15k forks source link

ItemsControl / ListBox Issues Roll-up #13736

Open robloo opened 8 months ago

robloo commented 8 months ago

Describe the bug

This is a Roll-up of Issues

Over the months the new ListBox and ItemsControl with many virtualization improvements has been put to the test. There are still some open issues with this group of controls after the rewrite that I want to summarize here. These issues are severe enough in some cases to prevent usage in production apps and also did not exist in the 0.10 version which performed almost flawlessly in general use (without virtualization).

Other

Expected behavior

Everything should work as well as WPF and 0.10.

Additional context

This is a rough issue for now. There are many different issues and this is a first attempt to start bringing them all together and make sense of it. Expect this issue to change quite a bit as things are narrowed down and better understood. As I find better bug reports those will be linked in as well.

See individual issues and discussions for more details.

grokys commented 8 months ago

Thanks for putting this together @robloo ! I hope to start looking into this issues next week.

robloo commented 8 months ago

@grokys I'm glad I can help a little. Great work with these controls!

grokys commented 8 months ago

ObservableCollection changes are not picked up and processed correctly. It seems to corrupt the state in some cases if the bound collection is cleared/reset OR items are added/remove.

Do we have a simple repro for this anywhere?

robloo commented 8 months ago

ObservableCollection changes are not picked up and processed correctly. It seems to corrupt the state in some cases if the bound collection is cleared/reset OR items are added/remove.

Do we have a simple repro for this anywhere?

Not that I've seen in the bug reports. This is just a general impression I've had and I've seen it with internal apps as well. I'll spend some time to try and find an exact repro.

robloo commented 8 months ago

I'm attempting to isolate some repro for these narrowed cases:

  1. ItemsSource changing references in the view model (i.e. set a new ObservableCollection to the property bound to ItemsSource)

    There have been a few different reports of issues here and I've seen some cases myself. However, I can't repro it in a simple test case. There is still an open bug report for somethin related though: https://github.com/AvaloniaUI/Avalonia/issues/11846

  2. Adding/Removing items from an existing ObservableCollection isn't displaying correctly in the UI.

    This one I'm not 100% sure is a stand-alone issue. It could be related to older issues and the VirtualizaingStackPanel fixes already made. Because I'm not sure this is a real problem I'm going to ignore it without further information. Also note I cannot repro it in a simple test case.

  3. Changing existing view models within an existing observable collection (recycling).

    I've seen issues with this in a real app and there are some other bug reports and comments I've seen to indicate it's a problem. For example it might be related to this somehow: https://github.com/AvaloniaUI/Avalonia/issues/13751. However, I also cannot repro this in a simple case. I will attempt to isolate it more in the actual app.

    Also note that UWP/WinUI marshalled INotifyPropertyChanged automatically to the UI thread in the case of bindings and things. I don't think Avalonia does that. This MAY be a contributor as code I'm working with was ported so this type of thing can be hard to find after the fact. I'm attempting to confirm all UI updating code paths are getting run on the UI thread.

    A takeaway here is if Avalonia does not automaticaly marshel INotifyPropertyChanged to the UI thread for binding perhaps it should and that could be done with the binding refactoring.

Bottom line, don't waste your time on the points I can't confirm. Those were general categories of issues I thought there were problems but it needs to be understood more.

timunie commented 8 months ago

To add: https://github.com/AvaloniaUI/Avalonia/issues/13751

timunie commented 8 months ago

Yet probably another one: https://github.com/AvaloniaUI/Avalonia/issues/13875

maxkatz6 commented 6 months ago

14389 #14365

MrJul commented 5 months ago

Another one: #14718

timunie commented 5 months ago

adding https://github.com/AvaloniaUI/Avalonia/issues/14814

timunie commented 4 months ago

yet another: https://github.com/AvaloniaUI/Avalonia/issues/15194

@robloo we may want to update the check-list the other day to reflect current status better.

jpgarza93 commented 1 day ago

Unfortunately, some of my app's ComboBoxes are now experiencing this when I upgraded to Avalonia 11.1.1 (which I had to, due to other bugs in v10) so now I'm stuck :(

Any update on the 2 remaining unchecked items?