Uncaught exception or assertion failure: System.Collections.Generic.KeyNotFoundException for listView's setSorting test scenario
See original GitHub issue.NET version
.Net 7.0 SDK: 7.0.100-preview.5.22226.4
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
Yes, it is a regression issue in recent .Net 7.0 build from main branch, cannot repro in .Net 7.0 SDK build: 7.0.100-preview.5.22220.23, it may be caused by PR: https://github.com/dotnet/winforms/pull/7029
Issue description
Uncaught exception or assertion failure: System.Collections.Generic.KeyNotFoundException when running automation XListView case for setSorting scenario
Steps to reproduce
We cannot get a manual repro, just met it when running our internal automation case about ListView with setSorting scenario, get following calll stack for product code:
Uncaught exception or assertion failure: System.Collections.Generic.KeyNotFoundException System.Collections.Generic.KeyNotFoundException: The given key ‘0’ was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at System.Windows.Forms.ListView.ListViewNativeItemCollection.get_Item(Int32 displayIndex) in D:\WinForms\Fork\winforms\src\System.Windows.Forms\src\System\Windows\Forms\ListView.ListViewNativeItemCollection.cs:line 83 at System.Windows.Forms.ListView.ListViewItemCollection.get_Item(Int32 index) in D:\WinForms\Fork\winforms\src\System.Windows.Forms\src\System\Windows\Forms\ListView.ListViewItemCollection.cs:line 107 at System.Windows.Forms.ListView.WmReflectNotify(Message& m) in D:\WinForms\Fork\winforms\src\System.Windows.Forms\src\System\Windows\Forms\ListView.cs:line 6614 at System.Windows.Forms.ListView.WndProc(Message& m) in D:\WinForms\Fork\winforms\src\System.Windows.Forms\src\System\Windows\Forms\ListView.cs:line 6908 at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) in D:\WinForms\Fork\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Control.ControlNativeWindow.cs:line 65 at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) in D:\WinForms\Fork\winforms\src\System.Windows.Forms\src\System\Windows\Forms\Control.ControlNativeWindow.cs:line 114 at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam) in D:\WinForms\Fork\winforms\src\System.Windows.Forms\src\System\Windows\Forms\NativeWindow.cs:line 369
Issue Analytics
- State:
- Created a year ago
- Comments:13 (11 by maintainers)
Top GitHub Comments
How is the listview populated, and how is this method invoked?
Verified this issue on .NET SDK 7.0.100-preview.6.22352.1, it is fixed. The XListView and XListViewItem Cases automation run passed.