Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Unexplainable exceptions in DataGridView...

$
0
0

I have a bound DataGridView inside a form (bound to a BindingList<> that acts as the data source). There is a BackgroundWorker class that waits for and receives data in a background thread and the data is used to populate the contents of the BindingList<>. As a result, the contents of the DataGridView changes (rows get added, deleted, modified) whenever the BackgroundWorker thread receives fresh data.

The problem is this - every once in a while (it has happened a couple of times so far over the last six months), the application crashes because of ArgumentOutOfRangeException exception. Clicking on the "Details" button, I get the stack dump as shown at the end of this post.

Both the times the application crashed, the user was selecting multiple rows in the DataGridView using the mouse (the DataGridView.MultiSelect property is set to true and DataGridView.SelectionMode is set to FullRowSelect).

The strange thing is that my DataGridView.SelectionChanged event handler doesn't get called. Even stranger is the fact that my own exception handlers don't catch the exception and it is caught by the system. In fact, my Program.Main() that calls the Application.Run() method is inside a try-catch block (catching all Exception instances) - I would have thought the catch block would have caught this exception - but it is not (I know this because the catch blog logs all exceptions to a log file and I see no trace of this exception in the logs both the times the application crashed).

The frustrating part is that this is not a reproducible problem - like I mentioned earlier, it has happened twice so far over a six month period.

The fact that the call-stack does not contain any of my code makes me think that this could be a bug in the framework base classes? Anyone has encountered this or a similar problem before? If so, how did you resolve this?

Any help/information is much appreciated.

Thanks,
AJ


OS: Windows XP Pro (SP2)
.NET Framework version: 2.0.50727
IDE: Visual Studio 2005 (Version 8.0.50727.762)


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: rowIndex
   at System.Windows.Forms.DataGridView.SetSelectedRowCore(Int32 rowIndex, Boolean selected)
   at System.Windows.Forms.DataGridView.SelectRowRange(Int32 rowIndexFrom, Int32 rowIndexTo, Boolean select)
   at System.Windows.Forms.DataGridView.OnRowSelectMouseMove(HitTestInfo hti)
   at System.Windows.Forms.DataGridView.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DataGridView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
IDBMonitorClientLauncher
    Assembly Version: 1.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/mscorlib/2.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
IDBMonitorClient
    Assembly Version: 0.3.3604.30056
    Win32 Version: 0.3.0.0
    CodeBase: file:///G:/Viewer/IDB-DEV/IDB%20PROD/IDBMonitorClient/MON_PRO1/IDBMonitorClient.EXE
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Web.Services
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Web.Services/2.0.0.0__b03f5f7f11d50a3a/System.Web.Services.dll
----------------------------------------
ekxd3up8
    Assembly Version: 0.3.3604.30056
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

 

 


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>