Reputation: 11
Object reference not set to an instance of an object
I am getting this error sometimes. I have a page where I load questions and for some question system generate this error. Why do I get this error? Please help me.
Upvotes: 1
Views: 14880
Reputation: 15
You got null reference and if it can't handle it will show that message.
It can caused by some case
I suggest you to track the null value using a debug mode
Upvotes: 1
Reputation: 834
You get this error, whenever you are trying to make use of variable with Null value in it.
Upvotes: 0
Reputation: 20706
It means that somewhere something dereferences a null
reference. Crude example:
Foobar foo = null;
foo.DoSomething(); // this line will trigger a NullReferenceException
Here's what you can do:
Once you have found the culprit, you need to find out why it is null and what to do about it. The solution can be one of:
Upvotes: 2