The WinformsControlTest project exited when clicking Column2 header after clicked the Change DGV font button
area-controls-DataGridView
### .NET version
main branch of Winforms repo
### Did it work in .NET Framework?
Not tested/verified
### Did it work in any of the earlier releases of .NET Core or .NET 5+?
Repro in release/10.0, release/9.0, release/8.0 branch
### Issue description
The WinformsControlTest project exited when clicking Column2 header after clicked the **Change DGV font** button
https://github.com/user-attachments/assets/549214cb-b478-4f9b-a442-5242054f16d6
### Steps to reproduce
Test the sample app: [WinformsControlTest ](https://github.com/dotnet/winforms/tree/main/src/System.Windows.Forms/tests/IntegrationTests/DesignSurface/WinformsControlTest)in Winforms repo
1. Run the WinformsControlTest project
2. Click the DataGridView button to open the DataGridView dialog
3. Click the Change DGV font button
4. Click the Column2 header
**Call Stack:**
```
System.ArgumentException
HResult=0x80070057
Message=Object must be of type String.
Source=System.Private.CoreLib
StackTrace:
at System.String.CompareTo(Object value)
at System.Collections.Comparer.Compare(Object a, Object b)
at System.Windows.Forms.DataGridViewRowCollection.RowComparer.CompareObjects(Object value1, Object value2, Int32 rowIndex1, Int32 rowIndex2) in C:\Users\v-olzhan\source\repos\winforms\src\System.Windows.Forms\System\Windows\Forms\Controls\DataGridView\DataGridViewRowCollection.RowComparer.cs:line 114
```
关闭于 2026-04-16 2 条评论