0
votes

I had a project running without any problems on .NET Framework 4.5 but today I updated to 4.6.1 version and it crashes at the very beginning of the execution.

The message displayed is shown above:

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index at System.Windows.Forms.TreeNodeCollection.get_Item(Int32 index) at System.Windows.Forms.DataGridView.OnCurrentCellChanged(EventArgs e)
at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick) at System.Windows.Forms.DataGridView.SetAndSelectCurrentCellAddress(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick, Boolean clearSelection, Boolean forceCurrentCellSelection) at System.Windows.Forms.DataGridView.MakeFirstDisplayedCellCurrentCell(Boolean includeNewRow) at System.Windows.Forms.DataGridView.OnHandleCreated(EventArgs e) at System.Windows.Forms.Control.WmCreate(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

In my App.config file I have this:

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

Does anyone know what can be causing the problem? Is it related to the System.Windows.Forms and the .NET Framework 4.6.1 update?

Thanks in advance.

1
It is not very clear how a DataGridView causes a TreeView to update. Nor have any of those classes been modified between 4.5 and 4.6.1. My crystal ball says that bad data should be on the top of the list. You'll have to debug it. - Hans Passant
Are you running 64bit? It's not beyond the realms of possibility that you've run into another bug in RyuJIT - if you can't track anything else down, try disabling RyuJIT to see if it helps. - James Thorpe
Yes, I am running 64bit. I have tried disabling RyuJIT but still the same error. Any other tip? - Luis Pascual

1 Answers

1
votes

Finally I managed to solve it. The issue was that .NET Framework 4.6.1 has optimized something that made some parts of my code to run faster, so I had a collision with two events (one was supposed to run before the other and with .NET 4.6.1 was happening the opposite). That's why running it in .NET Framework 4.5 was working properly, the two events were launched in the correct order.