Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > nullreferenceexception

Reply
Thread Tools

nullreferenceexception

 
 
Jon Oringer
Guest
Posts: n/a
 
      05-18-2005
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
 
Reply With Quote
 
 
 
 
surfsecret@gmail.com
Guest
Posts: n/a
 
      05-18-2005


Jon Oringer wrote:
> 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



I think i figured it out - looks like i was calling a datagrid update
method from another thread - without knowing i was on another thread. I
had to use form.Invoke - works now.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.NullReferenceException occurred in Unknown Module William ASP .Net 0 08-10-2004 03:32 PM
nullreferenceexception when trying to fill an array of strings Fabio Papa ASP .Net 1 09-24-2003 08:49 PM
NullReferenceException...hitting them all today...on XmlNode return Kathy Burke ASP .Net 0 07-24-2003 08:08 PM
Help with System.NullReferenceException msnews.microsoft.com ASP .Net 1 07-16-2003 03:53 AM
Help Me~~My DropDownList Can not get the"BigClassList.SelectedItem.Text" there is an error: System.NullReferenceException huobazi ASP .Net 0 07-01-2003 10:38 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57