Re: NullReferenceException Message Feature Request
From: Stu Smith (stuarts_at_remove.digita.com)
Date: 02/19/04
- Next message: Novice: "Does the CLR execute unmanaged code?"
- Previous message: Jon Skeet [C# MVP]: "Re: Finding out the current class in a static method?"
- In reply to: Bryan Livingston: "NullReferenceException Message Feature Request"
- Next in thread: Ben Rush: "Re: NullReferenceException Message Feature Request"
- Reply: Ben Rush: "Re: NullReferenceException Message Feature Request"
- Reply: Bryan Livingston: "Re: NullReferenceException Message Feature Request"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 19 Feb 2004 09:30:22 -0000
Please tell me you have exceptions set to 'break' in the debugger.... if you
do, it's usually absolutely obvious what the null reference should have
been.
"Bryan Livingston" <anonymous@discussions.microsoft.com> wrote in message
news:6FDA50BD-7BF4-43C6-AD92-6DE18207002C@microsoft.com...
> 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
- Next message: Novice: "Does the CLR execute unmanaged code?"
- Previous message: Jon Skeet [C# MVP]: "Re: Finding out the current class in a static method?"
- In reply to: Bryan Livingston: "NullReferenceException Message Feature Request"
- Next in thread: Ben Rush: "Re: NullReferenceException Message Feature Request"
- Reply: Ben Rush: "Re: NullReferenceException Message Feature Request"
- Reply: Bryan Livingston: "Re: NullReferenceException Message Feature Request"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|