Bug 4000 - Crash in DataGridViewCellStyle.ApplyCellStyle when AlternatingRowsDefaultCellStyle is null.
Summary: Crash in DataGridViewCellStyle.ApplyCellStyle when AlternatingRowsDefaultCell...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: 2.10.x
Hardware: PC Windows
: Lowest normal
Target Milestone: Community
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-03-20 22:33 UTC by inspiredmars
Modified: 2017-09-01 11:56 UTC (History)
2 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 4000 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 inspiredmars 2012-03-20 22:33:01 UTC
This is a crash that occurs when a DataGridView's AlternatingRowsDefaultCellStyle is null. It does not occur on .net. It appears easy to fix - just add a null check at the start of ApplyStyle.

Stack trace:
System.NullReferenceException: Object reference not set to an instance of an obj
ect
  at System.Windows.Forms.DataGridViewCellStyle.ApplyStyle (System.Windows.Forms
.DataGridViewCellStyle dataGridViewCellStyle) [0x00000] in C:\cygwin\tmp\monobui
ld\build\BUILD\mono-2.10.8\mcs\class\Managed.Windows.Forms\System.Windows.Forms\
DataGridViewCellStyle.cs:266
  at System.Windows.Forms.DataGridViewCell.GetInheritedStyle (System.Windows.For
ms.DataGridViewCellStyle inheritedCellStyle, Int32 rowIndex, Boolean includeColo
rs) [0x00085] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Manag
ed.Windows.Forms\System.Windows.Forms\DataGridViewCell.cs:604
  at System.Windows.Forms.DataGridViewCell.get_InheritedStyle () [0x00000] in C:
\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Managed.Windows.Forms\Sy
stem.Windows.Forms\DataGridViewCell.cs:204
  at System.Windows.Forms.DataGridViewRow.PaintCells (System.Drawing.Graphics gr
aphics, Rectangle clipBounds, Rectangle rowBounds, Int32 rowIndex, DataGridViewE
lementStates rowState, Boolean isFirstDisplayedRow, Boolean isLastVisibleRow, Da
taGridViewPaintParts paintParts) [0x000de] in C:\cygwin\tmp\monobuild\build\BUIL
D\mono-2.10.8\mcs\class\Managed.Windows.Forms\System.Windows.Forms\DataGridViewR
ow.cs:575
  at System.Windows.Forms.DataGridViewRow.Paint (System.Drawing.Graphics graphic
s, Rectangle clipBounds, Rectangle rowBounds, Int32 rowIndex, DataGridViewElemen
tStates rowState, Boolean isFirstDisplayedRow, Boolean isLastVisibleRow) [0x0008
d] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Managed.Windows.
Forms\System.Windows.Forms\DataGridViewRow.cs:536
  at System.Windows.Forms.DataGridView.OnPaint (System.Windows.Forms.PaintEventA
rgs e) [0x00314] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Ma
naged.Windows.Forms\System.Windows.Forms\DataGridView.cs:4775
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x0
008a] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Managed.Windo
ws.Forms\System.Windows.Forms\Control.cs:5244
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x0
016b] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Managed.Windo
ws.Forms\System.Windows.Forms\Control.cs:5006
  at System.Windows.Forms.DataGridView.WndProc (System.Windows.Forms.Message& m)
 [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\Managed.
Windows.Forms\System.Windows.Forms\DataGridView.cs:5741
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.
Forms.Message& m) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\m
cs\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:228
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Fo
rms.Message& m) [0x00000] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs
\class\Managed.Windows.Forms\System.Windows.Forms\Control.cs:209
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wPa
ram, IntPtr lParam) [0x0008e] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8
\mcs\class\Managed.Windows.Forms\System.Windows.Forms\NativeWindow.cs:242