As a developer, we often encounter this exception: NullReferenceExceptionwith a known error message:
NullReferenceException
Object reference not set to instance object
Is it impossible for the .NET platform to return something a little more meaningful?
Sort of:
An object of type X named Y is not set to an instance of the object
An object has no name - so how can it tell you a name? A null reference could be loaded from a variable - or it could be returned by a method, property, etc.
JIT, , , , , , - , , .
, - , , - , , , .
. , NullReferenceException .:)
, , , . , NullReferenceException, (, ), . , , ArgumentNullException, , -, , : throw new ArgumentNullException("param1").
ArgumentNullException
throw new ArgumentNullException("param1")
, , - .
.