Bug 6641 - DataGridView throw unexpected exeption while drawing
Summary: DataGridView throw unexpected exeption while drawing
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: 2.10.x
Hardware: All All
: Lowest normal
Target Milestone: Community
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-08-22 08:24 UTC by tommy
Modified: 2017-09-01 11:56 UTC (History)
3 users (show)

Tags: mono-community
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 6641 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description tommy 2012-08-22 08:24:58 UTC
i have a Form with two datagridViews. if i select a row in datagridView_1 then i clear the dataGridView_2 Row Items and add new items. 
Somethimes when i select a row in datagridView_1 the system crashes and i can't catch the system exeption, because its an internal crash while drawing die dataGridView. I Think it occur while trying to draw the selcted Rows of dataGridView_2.

Operating System: MacOS
Mono Version: 2.10.9

Errorline:
System.ArgumentOutOfRangeException: Index is less than 0 or more than or equal to the list count.
Parameter name: index
1
at System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException (System.String name, System.Object actual, System.String message) [0x00000] in <filename unknown>:0
at System.Collections.ArrayList.get_Item (Int32 index) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridViewRowCollection.SharedRow (Int32 rowIndex) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.GetRowInternal (Int32 rowIndex) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.OnPaint (System.Windows.Forms.PaintEventArgs e) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.DataGridView.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0
Tue Aug 21 21:28:48 mono[12767] <Error>: kCGErrorCannotComplete: CGSDeviceGetGeometry: Invalid device window
Tue Aug 21 21:28:48 mono[12767] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Tue Aug 21 21:28:48 mono[12767] <Error>: kCGErrorCannotComplete: CGSDeviceSynchronize: Invalid device window
Comment 1 tommy 2013-02-27 01:54:51 UTC
i think i have figured out the problem:
- datagridView_2.selectedRows[0].index  = i
- when selecting an other Row on datagridView_1, the datagridView_2 get new items
- if (datagridView_2.Rows.Count < i) -->crash

the problem doesnt occur on debugging mode
Comment 2 tommy 2013-02-27 02:01:04 UTC
datagridView_2.ClearSelection(); has no effect
Comment 3 tommy 2013-02-27 02:10:01 UTC
for other people who have the problem, i have a little workaround: hust put a try catch statement in the "program.cs"