Bug 465019

Summary: DataGrid: Crash when adding a ColumnStyle and DataSource doesn't contain mapped column
Product: [Mono] Mono: Class Libraries Reporter: Mario Carrion <mcarrion>
Component: Windows.FormsAssignee: Mono Bugs <mono-bugs>
Status: RESOLVED FIXED QA Contact: Mono Bugs <mono-bugs>
Severity: Normal    
Priority: P5 - None CC: calberto.cortez
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.

Description Mario Carrion 2009-01-09 21:22:35 UTC
Created attachment 264246 [details]
Example.

1. Compile attached code.
2. Click "Add button"
3. Crash.

In .NET the example doesn't crash.

Output:

System.InvalidOperationException: The PropertyDescriptor for this column is a null reference
  at System.Windows.Forms.DataGridColumnStyle.CheckValidDataSource (System.Windows.Forms.CurrencyManager value) [0x00049] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs:384 
  at System.Windows.Forms.DataGridColumnStyle.SetDataGrid (System.Windows.Forms.DataGrid value) [0x0001f] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs:493 
  at System.Windows.Forms.DataGridColumnStyle.SetDataGridInColumn (System.Windows.Forms.DataGrid value) [0x00000] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs:498 
  at System.Windows.Forms.DataGridTextBoxColumn.SetDataGridInColumn (System.Windows.Forms.DataGrid value) [0x00000] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridTextBoxColumn.cs:329 
  at System.Windows.Forms.DataGridColumnStyle.SetDataGridInternal (System.Windows.Forms.DataGrid value) [0x00000] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridColumnStyle.cs:503 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.DataGridColumnStyle:SetDataGridInternal (System.Windows.Forms.DataGrid)
  at System.Windows.Forms.GridColumnStylesCollection.Add (System.Windows.Forms.DataGridColumnStyle column) [0x00029] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs:125 
  at sample.Example+<Example>c__AnonStorey0.<>m__0 (System.Object obj, System.EventArgs args) [0x00000] 
  at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x0001c] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:6033 
  at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x00024] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs:106 
  at System.Windows.Forms.ButtonBase.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00081] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs:634 
  at System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00000] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs:128 
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00081] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5595 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x0017c] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5332 
  at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& m) [0x00055] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs:692 
  at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m) [0x00000] in /home/mario/repository/mcarrion/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs:150 
  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
Comment 1 Carlos Alberto Cortez 2009-08-04 03:48:33 UTC
This is fixed in rev 139314.