ASP.NET: Object reference not set to an instance of an object.
Hello,
We have developed a website and right now, it is running on the production environment.
It is running great on production environment but sometime it gives an error "Object reference not set to an instance of an object."
As of now, we have done concrete the problem. When user clicks on pop up window and close that window and Asychronous request goes to close that window. After that instantly click on "Update" button then this error comes.
It means that Page is not rendered properly.
Can anyone give assistance on it i.e. how to resolve it?
This error means that your code is trying to use an object that is not instantiated on the moment your code try to call it.
Maybe the window you close is the one who instantiates the object, and when you close it, this object is sent to memory cleaner, so when another part of your code tries to reach it the exception is fired.
You should stretch the line where the error is raised and see what object is being called. Then you'll be able to see clearly what's happening.
SAMIR BHOGAYTAFreelancer and IT ConsultantCommented:
Hello,
May be your code is trying to use the object which is not instantiated into your code. OR may be the database is not properly connected at the time of pass the query for that page.
Post your code.. this would be helpful to see where the error is..
thanks!
0
There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.
FYI only, we grab the issue. I tried to same "object reference" error from other development machine but we couldn't. So, we created new published code from that development machine and tried to replicate but error didn't come.
It means that there is problem with old development machine from where we created published code everytime.
There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.
Maybe the window you close is the one who instantiates the object, and when you close it, this object is sent to memory cleaner, so when another part of your code tries to reach it the exception is fired.
You should stretch the line where the error is raised and see what object is being called. Then you'll be able to see clearly what's happening.