New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataGridCheckBoxColumn usage -- throws an Unhandled exception. #3973
Comments
Reproduced on Windows 10 as well -- so it has nothing to do with the underlying OS or windowing system. |
Hello world, The link you provided is wrong (found the article nevertheless) Regards, Remco |
Thanks for the reply. I have corrected the link.
|
mmmmm. If you run the app without the changes you made, does it run then properly? Remco |
Thanks for the reply. For the time being I have given up on finding a solution. Maybe it will go away in the future. On the extra click thing , I have read somewhere on the net that the first click is just for selecting the checkbox (and the second click is for actually checking/unchecking) -- while the three valued checkbox looks very different (I've tried that as well).
|
if thats works than that is a reasenable solution, actually, i was at te point to advice a datatemplete which this basicly is. Stil dont know why it fails i made several datagrid test project with succces Mabe the wrong version (0.9.1 is a bit old) latest version now is 0.9.9 i believe. Regards, Remco |
Its the latest version. It is 0.9.10 ( and NOT 0.9.1 ). |
Yeay your right, my bad. |
This is also happening with 0.9.12. However, if I put an Exit button and call this.Close() the exception is not thrown. @danwalmsley Is this being looked at? |
This happens when DataGridCheckBoxColumn is used in a DataGrid and is bound to a boolean property in the backing model. When the column is clicked and the check boxes checked/unchecked -- it behaves as expected -- but then when I close the main window, the exception is thrown. This does not happen when only text columns are used and interacted with. It also doesn't happen if I do NOT interact with the checkbox column at all and just close the window. It only happens when I close the window AFTER I have interacted with the check box column.
Development environment:
OSes:
Dev: dotnet core 3.1.103
IDE: VS Code
Steps to reproduce:
General procedure to use a DataGrid was that mentioned in the tutorial article:
Avalonia DataGrid getting started
The only key change I made to the article was adding a DataGridCheckBoxColumn to the DataGrid and adding a boolean IsChecked property to the "Person" model class used in the tutorial -- and then bind the two together.
So the key steps are:
$ dotnet new avalonia.mvvm
$ dotnet add package Avalonia.Controls.DataGrid
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Default.xaml"/>
When I click in the checkboxes column -- the check boxes do get checked and unchecked as expected (although one extra click is required). But then when I close the window by clicking on the "X" on right upper corner -- that's when the unhandled exception happens -- NOT before that.
The complete exception text:
Unhandled exception. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List
1.Enumerator.MoveNextRare() at Avalonia.Collections.AvaloniaList
1.Enumerator.MoveNext()at System.Linq.Enumerable.OfTypeIterator[TResult](IEnumerable source)+MoveNext()
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Visual.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Input.InputElement.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
at Avalonia.Controls.TopLevel.HandleClosed()
at Avalonia.Controls.WindowBase.HandleClosed()
at Avalonia.Controls.Window.HandleClosed()
at Avalonia.X11.X11Window.Cleanup()
at Avalonia.X11.X11Window.Dispose()
at Avalonia.X11.X11Window.OnEventSync(XEvent ev)
at Avalonia.X11.X11Window.OnEvent(XEvent ev)
at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken)
at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken)
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode)
at d3.Program.Main(String[] args) in /home/[myusername]/[pathtoproject]/Program.cs:line 14
The text was updated successfully, but these errors were encountered: