[Mono-bugs] [Bug 492549] New: DataGridView: Clearing columns and re-adding when when CurrentCell is set throws Exception. .NET difference

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Apr 6 14:22:38 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=492549


           Summary: DataGridView: Clearing columns and re-adding when when
                    CurrentCell is set throws Exception. .NET difference
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: tom_hindle at sil.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=284310)
 --> (http://bugzilla.novell.com/attachment.cgi?id=284310)
Test case showing problem with clearing Columns and re-adding when CurrentCell
is set

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8)
Gecko/2009032711 Ubuntu/8.04 (hardy) Firefox/3.0.8

throws ArgumentOutOfRangeException

when the following is done:

m_grid.CurrentCell = m_grid[0, 0];
m_grid.Columns.Clear();
m_grid.Columns.Add(" ", string.Empty);

See attached test case.


Reproducible: Always

Steps to Reproduce:
1. Compile and Run attached test case
2.
3.
Actual Results:  
Unhandled Exception: System.ArgumentOutOfRangeException: Index is less than 0
or more than or equal to the list count.
Parameter name: index
0
  at System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException
(System.String name, System.Object actual, System.String message) [0x00000] in
/home/hindlet/src/monosvn/mcs/class/corlib/System.Collections/ArrayList.cs:3258 
  at System.Collections.ArrayList.get_Item (Int32 index) [0x00013] in
/home/hindlet/src/monosvn/mcs/class/corlib/System.Collections/ArrayList.cs:2649 
  at System.Windows.Forms.DataGridViewRowCollection.SharedRow (Int32 rowIndex)
[0x00000] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewRowCollection.cs:510 
  at System.Windows.Forms.DataGridView.GetRowInternal (Int32 rowIndex)
[0x00000] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:2479 
  at System.Windows.Forms.DataGridView.GetCellInternal (Int32 colIndex, Int32
rowIndex) [0x00000] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:2484 
  at System.Windows.Forms.DataGridView.OnCellLeave
(System.Windows.Forms.DataGridViewCellEventArgs e) [0x00000] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:3572 
  at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore (Int32
columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean
validateCurrentCell, Boolean throughMouseClick) [0x00193] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:5574 
  at System.Windows.Forms.DataGridView.MoveCurrentCell (Int32 x, Int32 y,
Boolean select, Boolean isControl, Boolean isShift, Boolean scroll) [0x00135]
in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:6154 
  at System.Windows.Forms.DataGridView.ClearBinding () [0x0001d] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:6037 
  at System.Windows.Forms.DataGridView.ReBind () [0x00012] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:6309 
  at System.Windows.Forms.DataGridView.OnColumnAddedInternal
(System.Windows.Forms.DataGridViewColumnEventArgs e) [0x0002c] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:3756 
  at System.Windows.Forms.DataGridView.OnColumnCollectionChanged (System.Object
sender, System.ComponentModel.CollectionChangeEventArgs e) [0x00020] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:5759 
  at System.Windows.Forms.DataGridViewColumnCollection.OnCollectionChanged
(System.ComponentModel.CollectionChangeEventArgs e) [0x00017] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnCollection.cs:231 
  at System.Windows.Forms.DataGridViewColumnCollection.Add
(System.Windows.Forms.DataGridViewColumn dataGridViewColumn) [0x00020] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnCollection.cs:83 
  at System.Windows.Forms.DataGridViewColumnCollection.Add (System.String
columnName, System.String headerText) [0x00014] in
/home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumnCollection.cs:93 
  at Form1..ctor () [0x000f5] in
/home/hindlet/src/svn/testrepo/tom/GetResourcesTest/TestResources/TestResources/ClearingColumnsWithCurrentCellSelected.cs:38 
  at (wrapper remoting-invoke-with-check) Form1:.ctor ()
  at Form1.Main () [0x00005] in
/home/hindlet/src/svn/testrepo/tom/GetResourcesTest/TestResources/TestResources/ClearingColumnsWithCurrentCellSelected.cs:12

Expected Results:  
Grid should load with a single cell, which should be selected.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list