Closed Howard0101 closed 2 weeks ago
@Olina-Zhang can your team regress this and let us know if we've ever done this differently for Framework or Core versions? Thanks!
@merriemcgaw, the issue still can reproduce from .NET Core 3.1 to .NET 9.0, and also no below code section generated in the Form1.Designer.cs file between Dev17 17.11.4 and latest Dev17 main versions.
And the issue also can reproduce on .NET Framework project which have the same behavior with .NET project.
columnHeader1.Name = "columnHeader1";
columnHeader2.Name = "columnHeader2";
A simple fix we tried in the past had introduced regression, given that this behavior existed in .NET Framework , it does not meet the bar at this point
Environment
Microsoft Visual Studio Enterprise 2022 (64-bit) - Current Version 17.11.4
.NET version
NET 8
Did this work in a previous version of Visual Studio and/or previous .NET release?
I honestly do not know
Issue description
The ListView Columns IndexOfKey function ALWAYS returns -1 (=not found). Eventhough the column name is correct and set in the VS Designer.
Steps to reproduce
Using NET 8 Windows Forms and creating a Windows Form with Visual Studio Designer which contains a ListView Control listView, I added some ColumnHeaders with Name (example "aCreatedHeader") and Text (example "Header") Properties. In the code behind try to use the function listView.Columns.IndexOfKey("aCreatedHeader"). It will ALWAYS return -1 since the deisgner neglets to write the name Property in the corresponding designer.cs file.
Please reopen closed Ticket #2867 or #2869 .
Diagnostics
No response