One of my coworker showed me how to use WinDbg tool for debugging managed apps. Many times we see in Test Environments that exception is thrown but its not getting logged anywhere and its difficult to find the exact reason.
This is where WinDbg comes in. Windbg stands for windows debugger. It is a multipurpose tool which can be used to analyse dumps, Finding exception, getting stackTrace etc. There are couple of steps that you need to take to use this tool.
1) WinDbg is a free tool. Just google it or click here http://lmgtfy.com/?q=download+windbg
2) WinDbg gets installed in C:\ProgramFiles\Debugging tools for windows
3) Launch windbg.exe, And type this command
.loadby sos mscorwks
This is an extension that you need to load to debug Managed applications.
4) Go to Debug Menu/ Event Filters -- enable CLR Exception
5) Attach to the w3wp.exe process and Start the Debugger Or Click F5.
6) You can view all the exception thrown by your application, stack trace, function parameters by using different commands
!pe ---> Print Exception
!clrstack --> Print the whole stack Trace.
!help --> To view all commands available in Windbg.