Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Cannot locate source of "Object reference not set to an instance of an object."

Reply
Thread Tools

Cannot locate source of "Object reference not set to an instance of an object."

 
 
Gummy
Guest
Posts: n/a
 
      01-03-2006
Hello,

I've been banging my head against the wall for a few days on this.

When I run a page, either in "View in Browser" or I actually build the
solution, I occasionally and very randomly get the following message:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.



When I set the Debugger to break during Exceptions, it breaks before any
code and just showed me some assembly-language looking stuff (I certainly
don't know about this).

I tried making a completely new solution, and bit-by-bit figure out where
the error is occurring. This started off OK, and I have a general idea where
it may be, but I am still having a problem pinpointing it.

Could anyone kindly give some suggestions on finding the problem?

Thanks so much.




 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      01-03-2006
Gummy,
what you are missing is a way to handle unhandled exceptions and do
something useful. Consider:

ASP.NET : GetLastError Handler:
// in global.asax:
protected void Application_Error(Object sender, EventArgs e)
{
ExceptionHandler.LogException exc = new ExceptionHandler.LogException();
Exception ex = Server.GetLastError().GetBaseException();
// pass ex to your logging or notification utility
}

Your loggin utiity could be as simple as a text file or the Event Log, I
leave that implementation up to you. Make sure you capture the StackTrace as
that is where the exact line of code where things "blew up" is identified.
Good luck!
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"Gummy" wrote:

> Hello,
>
> I've been banging my head against the wall for a few days on this.
>
> When I run a page, either in "View in Browser" or I actually build the
> solution, I occasionally and very randomly get the following message:
> Object reference not set to an instance of an object.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
>
> Exception Details: System.NullReferenceException: Object reference not set
> to an instance of an object.
>
> Source Error:
>
> An unhandled exception was generated during the execution of the
> current web request. Information regarding the origin and location of the
> exception can be identified using the exception stack trace below.
>
>
>
> When I set the Debugger to break during Exceptions, it breaks before any
> code and just showed me some assembly-language looking stuff (I certainly
> don't know about this).
>
> I tried making a completely new solution, and bit-by-bit figure out where
> the error is occurring. This started off OK, and I have a general idea where
> it may be, but I am still having a problem pinpointing it.
>
> Could anyone kindly give some suggestions on finding the problem?
>
> Thanks so much.
>
>
>
>
>

 
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
"Object reference not set to an instance of an object" Weird thing happens with reference a link nguyentrongkha@gmail.com ASP .Net 1 09-20-2007 09:46 PM
Error:Object reference not set to an instance of an object. Suresh Kojhani ASP .Net 1 07-29-2004 12:10 PM
Error !Object reference not set to an instance of an object. !!! Help Parthiv Joshi ASP .Net 2 07-02-2004 10:28 AM
Object reference not set to an instance of an object. yysiow ASP .Net 1 07-12-2003 03:30 PM
Object reference not set to an instance of an object. Chris Fink ASP .Net 2 07-03-2003 06:48 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