From: Gilbert Tordeur on 12 Apr 2010 05:14 Hello. An ASP.NET application reports the following error : .... [NullReferenceException: Object reference not set to an instance of an object.] RefFlu050.Page_Load(Object sender, EventArgs e) +1174 .... How can I identify which statement in my source code corresponds to RefFlu050.Page_Load +1174 ? Thanks in advance, Gilbert
From: Patrice on 12 Apr 2010 05:34 Hello, How long is Page_load ? Some prefer to enable PDB files to get line numbers. My personal experience is that if the app is well structured to it is actually fairly easy to find out where it fails. Here you are trying to use an object that is still Nothing (for example FindControl would be a posisble cullprit). -- Patrice "Gilbert Tordeur" <gilbert.tordeur(a)orange.fr> a �crit dans le message de news:u8o9XCi2KHA.5212(a)TK2MSFTNGP04.phx.gbl... > Hello. > > An ASP.NET application reports the following error : > > ... > [NullReferenceException: Object reference not set to an instance of an > object.] > RefFlu050.Page_Load(Object sender, EventArgs e) +1174 > ... > > How can I identify which statement in my source code corresponds to > RefFlu050.Page_Load +1174 ? > > Thanks in advance, > Gilbert >
From: Mr. Arnold on 12 Apr 2010 08:05 Gilbert Tordeur wrote: > Hello. > > An ASP.NET application reports the following error : > > ... > [NullReferenceException: Object reference not set to an instance of an > object.] > RefFlu050.Page_Load(Object sender, EventArgs e) +1174 > ... > > How can I identify which statement in my source code corresponds to > RefFlu050.Page_Load +1174 ? > > Thanks in advance, > Gilbert > > You put a debug brake point on the first line in Page_Load, and you start single stepping until it blows. Then you'll have a line number where it blew and the line. The other thing you do is turn on 'line numbering' in VS for code text and the HTML text for the editor, as it could be blowing in the HTML too, which will show you the line numbers.
From: Mr. Arnold on 12 Apr 2010 09:38 Gilbert Tordeur wrote: > Hi Patrice. > > I have been discouraged to enable PDB in production. I understand the nature > of the error (use of an object that has not yet been assigned). > > My question is : can I use the information "+1174" somehow to identify which > statement it is related to ? This is a very rare error that we do not > understand and that we are not able to redo on demand. > Well, you need a try/catch in the area where you might think the problem is at and the try/catch should encompass any sub code that might be called. catch ex ex.ToString() It will give the module name and line number that aborted, along with the full stack trace with inner exception message if it exist.
From: Phill W. on 13 Apr 2010 10:43
On 12/04/2010 10:14, Gilbert Tordeur wrote: > An ASP.NET application reports the following error : > > ... > [NullReferenceException: Object reference not set to an instance of an > object.] > RefFlu050.Page_Load(Object sender, EventArgs e) +1174 > How can I identify which statement in my source code corresponds to > RefFlu050.Page_Load +1174 ? "+1174" denotes an offset into I.L. Code and not a line number. You know which routine the exception occurred in (RefFlu050.Page_Load), so you can use ildasm to "pull apart" that particular method. The offsets appear down the lefthand side, prefixed with "IL_": IL_001b: ldloc.1 IL_001c: ldarg.1 IL_001d: ldarg.2 IL_001e: ldarg.3 IL_001f: callvirt instance class [System.Data]System.Data.DataSet [A.B.C.Processor]A.B.C.ID::E(string, class [A.B.MiddleTier]A.B.C/ClientData, class [A.B.Errors]A.B.IC&) IL_0024: stind.ref IL_0025: ldarg.3 IL_0026: ldind.ref The "callvirt" entries are probably the most important ones, being calls to others methods, hopefully ones that you wrote. HTH, Phill W. |