While on the subject of debugging, I should not neglect to mention my all-time favorite debugging trick. First, step back a second and think: have you ever encountered the following vile and worse than useless bit of code?
try
{
//some code...
}
catch(Exception)
{
}
I have. Here's the easy way to find these heinous little buggers. Burried within Visual Studio .Net and Visual Studio 2005 is the “Exceptions” dialog (menu: Debug / Exceptions). The one in 2005 is considerably more friendly, but the basic idea with both is that you can tell the debugger to break (just like a break-point) when an exception is about to be thrown. Brilliant. By default, you only get a break when an unhandled exception is thrown. The above code, of course, “handles” any exception and thus renders the default setting quite useless.