G
Guest
I'm guessing that NullReferenceExceptions are by far the most common exceptions thrown in .net.
Why not add the type of the reference to the message? Have it say something like:
Object reference of type 'string' not set to an instance of an object.
This would really help when trying to figure out where the null reference is happening.
I've just spent the last two days finding a null reference that happens very intermittently. Having the type would have saved me many hours.
In addition to just the type, you might be able to use reflection to give a property name or variable name.
Bryan Livingston
Alphora.com
Why not add the type of the reference to the message? Have it say something like:
Object reference of type 'string' not set to an instance of an object.
This would really help when trying to figure out where the null reference is happening.
I've just spent the last two days finding a null reference that happens very intermittently. Having the type would have saved me many hours.
In addition to just the type, you might be able to use reflection to give a property name or variable name.
Bryan Livingston
Alphora.com