|
Bugzilla – Full Text Bug Listing |
| Summary: | DataGridViewRowCollection.Insert is broken | ||
|---|---|---|---|
| Product: | [Mono] Mono: Class Libraries | Reporter: | Mario Carrion <mcarrion> |
| Component: | Windows.Forms | Assignee: | Forgotten User CRPsQFwJ3b <forgotten_CRPsQFwJ3b> |
| Status: | RESOLVED FIXED | QA Contact: | Mono Bugs <mono-bugs> |
| Severity: | Normal | ||
| Priority: | P5 - None | CC: | forgotten_CRPsQFwJ3b |
| Version: | SVN | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Other | ||
| Whiteboard: | |||
| Found By: | Beta-Customer | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
| Bug Depends on: | |||
| Bug Blocks: | 468504 | ||
| Attachments: |
Example.
Output .NET Screenshot Another example Patch Fix |
||
Created attachment 270516 [details]
Output
Created attachment 270519 [details]
.NET Screenshot
Created attachment 270532 [details]
Another example
This example is similar to previous one, but shows the issue in a different way, seems that DataGridViewRowCollection.Insert() should be using list.Insert instead of using list[].
(Would be awesome to attach several patches at same time in bugzilla)
I wrote an attempt to patch continue reading in next comment.
Created attachment 270536 [details]
Patch
However with this patch, I got the following exception after OnPaint, so I'm sure I'm missing something really important.
mario@malakarma:~/trashme> gmcs -r:System,System.Windows.Forms,System.Drawing dgrid1.cs && mono --debug dgrid1.exe
System.ArgumentOutOfRangeException: Index is less than 0 or more than or equal to the list count.
Parameter name: index
2
at System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException (System.String name, System.Object actual, System.String message) [0x00000] in /home/mario/repository/mcarrion/mcs/class/corlib/System.Collections/ArrayList.cs:3258
at System.Collections.ArrayList.get_Item (Int32 index) [0x00013] in /home/mario/repository/mcarrion/mcs/class/corlib/System.Collections/ArrayList.cs:2649
at System.Windows.Forms.DataGridViewRowCollection.get_Item (Int32 index) [0x00000] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs:82
at System.Windows.Forms.DataGridViewRow.GetState (Int32 rowIndex) [0x0004c] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRow.cs:445
at System.Windows.Forms.DataGridView.OnPaint (System.Windows.Forms.PaintEventArgs e) [0x0036c] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:4583
at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x0008a] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5561
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x0016c] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5319
at System.Windows.Forms.DataGridView.WndProc (System.Windows.Forms.Message& m) [0x00000] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:5521
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:234
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:215
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00085] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:242
Fixed in trunk in r125900 and in 2.4 branch in r125901. You are right the problem was indeed what you say bundles with some redraw issues. Patch attached FYI. Created attachment 270550 [details]
Fix
Marking as fixed. Thanks for the quick fix! |
Created attachment 270515 [details] Example. 1. Compile attached code. 2. click "Add row" button. 3. Crash. .NET doesn't crash, see attached image to see behavior.