https://bugzilla.novell.com/show_bug.cgi?id=485278
User [email protected] added comment https://bugzilla.novell.com/show_bug.cgi?id=485278#c484989 Summary: DataGridView: Accessing OwningColumn Property of a cell from OnRowStateChanged event handler crashed on mono Classification: Mono Product: Mono: Class Libraries Version: SVN Platform: i686 OS/Version: Ubuntu Status: NEW Severity: Normal Priority: P5 - None Component: Windows.Forms AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.7) Gecko/2009030422 Ubuntu/8.04 (hardy) Firefox/3.0.7 Test Program: This Test code depends on bugzilla issue #484989 being fixed. using System; using System.Drawing; using System.Windows.Forms; public class MyDataGridView : DataGridView { protected override void OnHandleCreated(EventArgs e) { Console.WriteLine("OnHandleCreated Start"); base.OnHandleCreated(e); Console.WriteLine("OnHandleCreated End"); } } public class Form1 : System.Windows.Forms.Form { public Form1() { this.Load += new EventHandler(Form1_Load); } DataGridView m_grid = new MyDataGridView(); private void Form1_Load(System.Object sender, System.EventArgs e) { m_grid.AllowUserToAddRows = false; m_grid.ColumnStateChanged += new DataGridViewColumnStateChangedEventHandler(OnColumnStateChanged); m_grid.RowStateChanged += new DataGridViewRowStateChangedEventHandler(OnRowStateChanged); Console.WriteLine("Before RowCount"); m_grid.RowCount = 3; Console.WriteLine("After RowCount"); m_grid.CurrentCell = m_grid.Rows[0].Cells[0]; this.Controls.Add(m_grid); Console.WriteLine("After Add Grid to Controls"); } protected virtual void OnRowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e) { Console.WriteLine(m_grid.CurrentCell.OwningColumn); Console.WriteLine("OnRowStateChanged {0}", e.Row); } protected virtual void OnColumnStateChanged(object sender, DataGridViewColumnStateChangedEventArgs e) { Console.WriteLine("OnColumnStateChanged {0}", e.Column); } [STAThreadAttribute()] static void Main() { Application.Run(new Form1()); } } Reproducible: Always Steps to Reproduce: 1. Compile and run test code 2. 3. Actual Results: Before RowCount After RowCount OnHandleCreated Start System.NullReferenceException: Object reference not set to an instance of an object at Form1.OnRowStateChanged (System.Object sender, System.Windows.Forms.DataGridViewRowStateChangedEventArgs e) [0x00000] in /home/tom/src/svn/testrepo/tom/DataGridViewTest/DataGridViewTest/DataGridViewTest.cs:39 at System.Windows.Forms.DataGridView.OnRowStateChanged (Int32 rowIndex, System.Windows.Forms.DataGridViewRowStateChangedEventArgs e) [0x0001c] in /home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:4957 at System.Windows.Forms.DataGridView.OnHandleCreated (System.EventArgs e) [0x0008a] in /home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:4035 at MyDataGridView.OnHandleCreated (System.EventArgs e) [0x0000a] in /home/tom/src/svn/testrepo/tom/DataGridViewTest/DataGridViewTest/DataGridViewTest.cs:10 at System.Windows.Forms.Control.WmCreate (System.Windows.Forms.Message& m) [0x00000] in /home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5759 at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001e4] in /home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5397 at System.Windows.Forms.DataGridView.WndProc (System.Windows.Forms.Message& m) [0x00000] in /home/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs:5591 at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in /home/hindlet/src/monosvn/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/hindlet/src/monosvn/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/hindlet/src/monosvn/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:242 After Add Grid to Controls Expected Results: Before RowCount After RowCount OnHandleCreated Start DataGridViewTextBoxColumn { Name=, Index=0 } OnRowStateChanged DataGridViewRow { Index=0 } DataGridViewTextBoxColumn { Name=, Index=0 } OnRowStateChanged DataGridViewRow { Index=1 } DataGridViewTextBoxColumn { Name=, Index=0 } OnRowStateChanged DataGridViewRow { Index=2 } OnColumnStateChanged DataGridViewTextBoxColumn { Name=, Index=0 } OnHandleCreated End After Add Grid to Controls -- Configure bugmail: https://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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
