I'm having a hard time debugging a nullreferenceexception in my datagrid --
the exception occurs in 'System' .. so its hard to debug..
i can't seem to figure out where the update in my code is causing this
nullreferenceexception ... when i break, the call stack looks like this:
A first chance exception of type 'System.NullReferenceException' occurred in
system.data.dll
Additional information: Object reference not set to an instance of an object.
the only thing i can tell by the call stack - is that the break happens at a
different row each time! so i can't even narrow it down by row updated.
How can i debug this??
here is the call stack:
system.data.dll!System.Data.DataColumnPropertyDesc riptor.GetValue(System.Object component = <undefined value>) + 0x29 bytes
system.windows.forms.dll!System.Windows.Forms.Data GridColumnStyle.GetColumnValueAtRow(System.Windows .Forms.CurrencyManager
source = {System.Windows.Forms.RelatedCurrencyManager}, int rowNum = 2

+
0x83 bytes
system.windows.forms.dll!System.Windows.Forms.Data GridTextBoxColumn.Paint(System.Drawing.Graphics
g = {System.Drawing.Graphics}, System.Drawing.Rectangle bounds = {X=37 Y=544
Width=74 Height=17}, System.Windows.Forms.CurrencyManager source =
{System.Windows.Forms.RelatedCurrencyManager}, int rowNum = 28,
System.Drawing.Brush backBrush = {Color={RGB=0x0}}, System.Drawing.Brush
foreBrush = {Color={RGB=0x0}}, bool alignToRight = false) + 0x25 bytes
system.windows.forms.dll!System.Windows.Forms.Data GridRelationshipRow.PaintCellContents(System.Drawi ng.Graphics
g = {System.Drawing.Graphics}, System.Drawing.Rectangle cellBounds = {X=37
Y=544 Width=74 Height=17}, System.Windows.Forms.DataGridColumnStyle column =
{HeaderText="DISP_NAME"}, System.Drawing.Brush backBr = {Color={RGB=0x0}},
System.Drawing.Brush foreBrush = {Color={RGB=0x0}}, bool alignToRight =
false) + 0x2bd bytes
system.windows.forms.dll!System.Windows.Forms.Data GridRow.PaintData(System.Drawing.Graphics
g = {System.Drawing.Graphics}, System.Drawing.Rectangle bounds = {X=37 Y=544
Width=753 Height=17}, int firstVisibleColumn = 0, int columnCount = 9, bool
alignToRight = false) + 0x276 bytes
system.windows.forms.dll!System.Windows.Forms.Data GridRelationshipRow.Paint(System.Drawing.Graphics
g = {System.Drawing.Graphics}, System.Drawing.Rectangle bounds = {X=37 Y=544
Width=753 Height=18}, System.Drawing.Rectangle trueRowBounds = {X=37 Y=544
Width=753 Height=18}, int firstVisibleColumn = 0, int numVisibleColumns = 9,
bool alignToRight = false) + 0x95 bytes
system.windows.forms.dll!System.Windows.Forms.Data Grid.PaintRows(System.Drawing.Graphics
g = {System.Drawing.Graphics}, System.Drawing.Rectangle boundingRect = {X=2
Y=40 Width=788 Height=550}) + 0x38f bytes
system.windows.forms.dll!System.Windows.Forms.Data Grid.PaintGrid(System.Drawing.Graphics
g = {System.Drawing.Graphics}, System.Drawing.Rectangle gridBounds = {X=2
Y=21 Width=788 Height=569}) + 0x1e2 bytes
system.windows.forms.dll!System.Windows.Forms.Data Grid.OnPaint(System.Windows.Forms.PaintEventArgs
pe = {ClipRectangle={X=2 Y=94 Width=788 Height=18}}) + 0x24d bytes
system.windows.forms.dll!System.Windows.Forms.Cont rol.PaintWithErrorHandling(System.Windows.Forms.Pa intEventArgs
e = {ClipRectangle={X=2 Y=94 Width=788 Height=18}}, short layer = 2, bool
disposeEventArgs = false) + 0x85 bytes
system.windows.forms.dll!System.Windows.Forms.Cont rol.WmPaint(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x570 bytes
system.windows.forms.dll!System.Windows.Forms.Cont rol.WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x2d6 bytes
system.windows.forms.dll!ControlNativeWindow.OnMes sage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x13 bytes
system.windows.forms.dll!ControlNativeWindow.WndPr oc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes
system.windows.forms.dll!System.Windows.Forms.Nati veWindow.DebuggableCallback(int
hWnd = 134070, int msg = 15, int wparam = 0, int lparam = 0) + 0x3d bytes
system.windows.forms.dll!System.Windows.Forms.Appl ication.ComponentManager.System.Windows.Forms.Unsa feNativeMethods+IMsoComponentManager.FPushMessageL oop(int dwComponentID = 1, int reason = -1, int pvLoopData = 0) + 0x349 bytes
system.windows.forms.dll!ThreadContext.RunMessageL oopInner(int reason =
-1, System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext}) + 0x1f3 bytes
system.windows.forms.dll!ThreadContext.RunMessageL oop(int reason = -1,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext}) + 0x50 bytes
system.windows.forms.dll!System.Windows.Forms.Appl ication.Run(System.Windows.Forms.Form mainForm = {Collector.Form1}) + 0x34 bytes
> RealTickTry2.exe!Collector.Form1.Main() Line 327 C#
--
Jon Oringer
http://www.shutterstock.com