View on GitHub

Devendra's Log

Log all CLR exceptions using WinDbg

This is a short post to complement my earlier post regarding post-mortem debugging. Sometimes, an application or service crashes without giving us an opportunity to save a detailed memory dump. In such a scenario, it may be useful to run WinDbg, attach to the process of the application or service, and log all exceptions that occur.

To log an exception (handled or not) and continue process execution use the following command in WinDbg

sxe -c "!pe;!clrstack;gc" clr

Please see this article for more details.