2016-03-02 106 views
0

我有一個項目在.NET Framework 4.5上沒有任何問題地運行,但今天我更新到4.6.1版本,它在執行開始時崩潰。System.Windows.Forms的.NET Framework 4.6.1錯誤

顯示該消息如上所示:

查看此消息的結尾的詳細信息,調用剛剛在時間 (JIT)調試而不是此對話框。

**************異常文本**************

System.ArgumentOutOfRangeException:指定參數超出所述 範圍的的有效值。參數名:在 System.Windows.Forms.TreeNodeCollection.get_Item(的Int32指數)在 System.Windows.Forms.DataGridView.OnCurrentCellChanged(EventArgs五)
在System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(的Int32 columnIndex指數,的Int32 rowIndex位置,布爾setAnchorCellAddress,布爾 validateCurrentCell,布爾throughMouseClick)在 System.Windows.Forms.DataGridView.SetAndSelectCurrentCellAddress(的Int32 columnIndex,的Int32 rowIndex位置,布爾setAnchorCellAddress,布爾 validateCurrentCell,布爾throughMouseClick,布爾 clearSelection,布爾forceCurrentCellSelection)在 System.Windows.Forms.DataGridView.MakeFirstDisplayedCellCu rrentCell(布爾 includeNewRow)處 System.Windows.Forms.Control.WmCreate(消息&米) System.Windows.Forms.DataGridView.OnHandleCreated(EventArgs e)上 System.Windows.Forms.Control.WndProc(消息& M)在 System.Windows.Forms.NativeWindow.Callback(IntPtr的的HWND,味精的Int32, IntPtr的WPARAM,LPARAM的IntPtr)

在我的App.config文件我有這樣的:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/> 
    </startup> 
</configuration> 

Doe有人知道什麼會導致問題?它是否與System.Windows.Forms.NET Framework 4.6.1更新有關?

在此先感謝。

+1

DataGridView如何導致TreeView更新並不十分清楚。也沒有任何這些類別在4.5和4.6.1之間被修改。我的水晶球說不好的數據應該在列表的頂部。你必須調試它。 –

+0

你正在運行64位?在RyuJIT中遇到另一個錯誤並沒有超出可能性 - 如果你不能追蹤其他任何東西,請嘗試[關閉RyuJIT](https://github.com/Microsoft/dotnet/blob/master/ docs/testing-with-ryujit.md)來查看它是否有幫助。 –

+0

是的,我正在運行64位。我曾嘗試禁用RyuJIT,但仍然是同樣的錯誤。任何其他小費? –

回答

1

最後我設法解決了它。問題是.NET Framework 4.6.1已經優化了一些讓我的代碼的某些部分運行得更快的東西,所以我碰到了兩個事件(一個應該在另一個之前運行,而.NET 4.6.1正在發生相反)。這就是爲什麼在.NET Framework 4.5中運行它正常工作的原因,這兩個事件以正確的順序啓動。

+0

我想知道哪些事件? –

+0

在.NET 4.6.1的ComboBox中,DataGrid中的'CurrentCellChanged'比'SelectedIndexChanged'更快。 –

相關問題