【发布时间】:2026-01-04 12:50:02
【问题描述】:
我有一个项目在.NET Framework 4.5 上运行没有任何问题,但今天我更新到 4.6.1 版本,它在执行一开始就崩溃了。
显示的信息如上图:
有关调用即时的详细信息,请参阅此消息的末尾 (JIT) 调试而不是此对话框。
**************异常文本**************
System.ArgumentOutOfRangeException:指定的参数超出 有效值的范围。参数名称:索引处 System.Windows.Forms.TreeNodeCollection.get_Item(Int32 索引)在 System.Windows.Forms.DataGridView.OnCurrentCellChanged(EventArgs e)
在 System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32 columnIndex,Int32 rowIndex,布尔值 setAnchorCellAddress,布尔值 validateCurrentCell, Boolean throughMouseClick) 在 System.Windows.Forms.DataGridView.SetAndSelectCurrentCellAddress(Int32 columnIndex,Int32 rowIndex,布尔值 setAnchorCellAddress,布尔值 validateCurrentCell, Boolean throughMouseClick, Boolean clearSelection, Boolean forceCurrentCellSelection) 在 System.Windows.Forms.DataGridView.MakeFirstDisplayedCellCurrentCell(布尔 包括新行)在 System.Windows.Forms.DataGridView.OnHandleCreated(EventArgs e) 在 System.Windows.Forms.Control.WmCreate(Message& m) 在 System.Windows.Forms.Control.WndProc(Message& m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32 消息, IntPtr wparam, IntPtr lparam)
在我的 App.config 文件中,我有这个:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>
有谁知道是什么导致了这个问题?是否与System.Windows.Forms 和.NET Framework 4.6.1 更新有关?
提前致谢。
【问题讨论】:
-
DataGridView 如何导致 TreeView 更新还不是很清楚。在 4.5 和 4.6.1 之间也没有修改任何这些类。我的水晶球说不良数据应该排在首位。你必须调试它。
-
您运行的是 64 位吗?您在 RyuJIT 中遇到另一个错误并没有超出可能的范围 - 如果您无法找到其他任何内容,请尝试 disabling RyuJIT 看看它是否有帮助。
-
是的,我正在运行 64 位。我试过禁用 RyuJIT 但仍然是同样的错误。还有其他提示吗?
标签: c# .net .net-framework-version