Visual Studio debugger tips & tricks for .NET
try {
// do something big
}
catch {
// breakpoint set here:
throw CantHappenException("something horrible happened that should never happen.");
}
How do you see the exception that was originally thrown? In a watch window, enter $exception
Here's another neat trick I learned:
System.Diagnostics.Debugger.Break()
programatically causes the debugger to break on the next instruction. The really nice part is, this also works for a program compiled in Release mode, without debugging information.