question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created a year ago
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
RussKiecommented, Apr 27, 2022

How is the listview populated, and how is this method invoked?

0reactions
Philip-Wang01commented, Jul 6, 2022

Verified this issue on .NET SDK 7.0.100-preview.6.22352.1, it is fixed. The XListView and XListViewItem Cases automation run passed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

xUnit tests suddenly throwing exception System. ...
I have an xUnit project that has run all tests flawlessly until now. I added two new test methods and now, suddenly, no...
Read more >
Assertion keeps failing in test class
I have added Case result = [SELECT Country_of_Origin__c FROM Case WHERE Id = :caseObj.Id]; But the insert fails? – Nik. Aug 20, 2015...
Read more >
Programming With Assertions
An assertion is a statement in the Java programming language that enables you to test your assumptions about your program. For example, if...
Read more >
"System.AssertException: Assertion Failed" error in my test ...
The test class can get me 100% code coverage and the UI operation all works beautifully. The issue is the test result returned...
Read more >
Assertions - F# | Microsoft Learn
Learn how to use the 'assert' expression as a debugging feature for testing expressions in the F# programming language.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found