Tuesday 11 October 2005 — This is more than 19 years old. Be careful.
I got this error message from .NET. It basically means “null pointer”:
Exception: Object reference not set to an instance of an object.
The more I look at it, the more I hate it. Why are there so many words? Who are we trying to impress? What’s an “instance of an object”? Don’t they mean:
Exception: Object reference not set to an instance of a class.
And isn’t “instance of a class” a fancy way to say “object”? So shouldn’t it be:
Exception: Object reference not set to an object.
And what else would it be set to? Can’t we just shorten this to:
Exception: Object reference not set.
Or why don’t we just say what we mean:
Exception: Null object reference.
Or, (heaven forbid):
Exception: Null pointer.
I know, I know, they aren’t pointers, they’re object references. Whatever. Bite me.
Comments
:)
"Exception: Null pointer. Bite me!"
You might as well change C++'s null pointer error to "Object pointer not set to address of object" :P
It's not clear where Ned saw this message but normally there would be a stack trace too. Code that just prints the exception text and doesn't log the stack is dopey as the message text.
Chris
The "or With block variable" part is correct, but confusing. Presumably some engineer couldn't resist including that.
I think it means the thing returned from an unmanaged call couldn't be coerced into the correct managed type. The most obvious reason would be a null pointer in unmanaged space, but maybe there are other possibilities. A misaligned pointer also springs to mind.
Add a comment: