Learning Resources
 

System.NullReferenceException


The exception that is thrown when there is an attempt to dereference a null object reference.

When you compile some code, it may have valid Microsoft intermediate language (MSIL). However, when you run the compiled application, you receive the following Unhandled Exception error message:
System.NullReferenceException: Object reference not set to an instance of an object.

If optimization is turned off, this exception error does not occur.
 

--Microsoft