donderdag, januari 19, 2006

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

When you receive this error, stop searching for a solution, first try to restart IIS (if that doesn't work: restart your pc) and check if the error is still there.... It worked with me, after searching an hour for a solution....

I also noticed that the vs 2003 debugger went very slow when the error occures


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.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.UI.Control.OnBubbleEvent(Object source, EventArgs args)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

6 opmerkingen:

Dale Preston zei

Thanks for posting this. It saved me a lot of searching.

I am surprised more people aren't posting this problem in the newsgroups. I'm curious what Microsoft has to say on the topic because it affects my production server as well.

Anoniem zei

Hi your blog is very nice.

http:\\rajmittal.blogspot.com

Anoniem zei

Thanks, Restart IIS works for me. It happened out of blue, and I was in panic mode for about an hour.

Anoniem zei

Thanks, but there is one more thing i would like to add if IISReset doesn't work try closing your .net application in my case that worked...

Amandeep

Anoniem zei

Hi,

I'm facing the same problem for long time ago. In my case, I cannot access image file that I locate in folder. This is the line code:

//load an image for subtract
System.Drawing.Bitmap image2 = (Bitmap)Bitmap.FromFile("plane.Jpeg");

//// apply filter subtract===>>>> call file from out bin folder <<<<=====
The error come from this line 
System.Drawing.Bitmap subtract = filter1.Apply(image2);

if I put comment notation before this line code, the application could run well.

I try to restart but it does'nt work. Any body could help me please...

Anoniem zei

It works for me, really helpful,

Thanks a lot.

Devidas Gaikwad