Tuesday, September 15, 2009

Get Exception without being in catch block

In .NET, when exception is thrown, the exception passed though the call stacks. While debugging you may not be inside the catch block (may be in finally) or you may not have catch block at all. But if you want to still see what exception occurred then just go to 'watch' window in visual studio and type '$exception' and you will get the exception as it is.

Happy Debugging!

ps: I got this trick free from my ex-colleague Manish