468,771 Members | 1,479 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,771 developers. It's quick & easy.

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

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.


Jan 3 '06 #1
1 2019
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.


Jan 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Etienne Charland | last post: by
reply views Thread by Looch | last post: by
4 posts views Thread by My Pet Programmer | last post: by
1 post views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.