Open ILSpy that has a previously opened assembly in the Assembly list but no longer exists (Yellow warning icon, tooltip "assembly could not be loaded, click here for details")
Right click on assembly to see context menu
Click "remove"
System crash as below
Workaround: Select the item instead and press "DEL" then item is correctly removed from the list
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at ICSharpCode.TreeView.TreeFlattener.get_Item(Int32 index) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/SharpTreeView/TreeFlattener.cs:line 64
at Avalonia.Controls.ItemsSourceView`1.GetAt(Int32 index) in /_/src/Avalonia.Controls/ItemsSourceView.cs:line 243
at Avalonia.Controls.Selection.SelectedItems`1.GetEnumerator()+MoveNext() in /_/src/Avalonia.Controls/Selection/SelectedItems.cs:line 89
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Avalonia.Controls.Primitives.SelectingItemsControl.OnSelectionModelSelectionChanged(Object sender, SelectionModelSelectionChangedEventArgs e) in /_/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs:line 818
at Avalonia.Controls.Selection.SelectionModel`1.CommitOperation(Operation operation, Boolean raisePropertyChanged) in /_/src/Avalonia.Controls/Selection/SelectionModel.cs:line 706
at Avalonia.Controls.Selection.SelectionModel`1.BatchUpdateOperation.Dispose() in /_/src/Avalonia.Controls/Selection/SelectionModel.cs:line 767
at Avalonia.Controls.Selection.InternalSelectionModel.OnSelectedItemsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Controls/Selection/InternalSelectionModel.cs:line 277
at Avalonia.Collections.AvaloniaList`1.Clear() in /_/src/Avalonia.Base/Collections/AvaloniaList.cs:line 229
at Avalonia.Collections.AvaloniaList`1.System.Collections.IList.Clear() in /_/src/Avalonia.Base/Collections/AvaloniaList.cs:line 554
at ICSharpCode.TreeView.SharpTreeView.SetSelectedNodes(IEnumerable`1 nodes) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/SharpTreeView/SharpTreeView.cs:line 754
at ICSharpCode.TreeView.SharpTreeView.UpdateFocusedNode(List`1 newSelection, Int32 topSelectedIndex) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/SharpTreeView/SharpTreeView.cs:line 184
at ICSharpCode.TreeView.TreeFlattener.NodesRemoved(Int32 index, IEnumerable`1 nodes) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/SharpTreeView/TreeFlattener.cs:line 51
at ICSharpCode.TreeView.SharpTreeNode.OnChildrenChanged(NotifyCollectionChangedEventArgs e) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/SharpTreeView/SharpTreeNode.cs:line 189
at ICSharpCode.TreeView.SharpTreeNodeCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/SharpTreeView/SharpTreeNodeCollection.cs:line 33
at ICSharpCode.TreeView.SharpTreeNodeCollection.RemoveRange(Int32 index, Int32 count) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/SharpTreeView/SharpTreeNodeCollection.cs:line 124
at ICSharpCode.ILSpy.TreeNodes.AssemblyListTreeNode.<>c__DisplayClass6_0.<BindToObservableCollection>b__1(Object sender, NotifyCollectionChangedEventArgs e) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/TreeNodes/AssemblyListTreeNode.cs:line 67
at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection`1.RemoveItem(Int32 index)
at System.Collections.ObjectModel.Collection`1.Remove(T item)
at ICSharpCode.ILSpy.AssemblyList.Unload(LoadedAssembly assembly) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/AssemblyList.cs:line 252
at ICSharpCode.ILSpy.TreeNodes.AssemblyTreeNode.DeleteCore() in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/TreeNodes/AssemblyTreeNode.cs:line 258
at ICSharpCode.ILSpy.TreeNodes.AssemblyTreeNode.Delete() in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/TreeNodes/AssemblyTreeNode.cs:line 253
at ICSharpCode.ILSpy.TreeNodes.RemoveAssembly.Execute(TextViewContext context) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/TreeNodes/AssemblyTreeNode.cs:line 380
at ICSharpCode.ILSpy.ContextMenuProvider.<>c__DisplayClass12_1.<ShowContextMenu>b__2(Object <p0>, RoutedEventArgs <p1>) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/ContextMenuEntry.cs:line 236
at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 152
at Avalonia.Interactivity.EventRoute.RaiseEvent(IInteractive source, RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 79
at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/Interactive.cs:line 123
at Avalonia.Controls.MenuItem.Avalonia.Controls.IMenuItem.RaiseClick() in /_/src/Avalonia.Controls/MenuItem.cs:line 333
at Avalonia.Controls.Platform.DefaultMenuInteractionHandler.Click(IMenuItem item) in /_/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs:line 456
at Avalonia.Controls.Platform.DefaultMenuInteractionHandler.PointerReleased(Object sender, PointerReleasedEventArgs e) in /_/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs:line 408
at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 152
at Avalonia.Interactivity.EventRoute.RaiseEvent(IInteractive source, RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 79
at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/Interactive.cs:line 123
at Avalonia.Input.MouseDevice.MouseUp(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers) in /_/src/Avalonia.Input/MouseDevice.cs:line 311
at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e) in /_/src/Avalonia.Input/MouseDevice.cs:line 144
at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e) in /_/src/Avalonia.Input/InputManager.cs:line 37
at Avalonia.RawEventGrouper.DispatchFromQueue() in /_/src/Shared/RawEventGrouping.cs:line 54
at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 37
at Avalonia.X11.X11PlatformThreading.HandleX11(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 169
at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken) in /_/src/Avalonia.X11/X11PlatformThreading.cs:line 245
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 65
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 209
at ICSharpCode.ILSpy.Program.Main(String[] args) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy/Program.cs:line 22
Open ILSpy that has a previously opened assembly in the Assembly list but no longer exists (Yellow warning icon, tooltip "assembly could not be loaded, click here for details") Right click on assembly to see context menu Click "remove" System crash as below
Workaround: Select the item instead and press "DEL" then item is correctly removed from the list