Wednesday, June 5, 2013

How to, use windbg to catch .net process exception

for some cases, you may find it’s hard to debug the .net application exception using mdbg or cordbg. then windbg will be the good shoot.

you don’t need to download the full sdk to the production server, just go to http://windbg.org/, under the windbg quick links download the x86 or 64 bit debuggers which are less then 20M , install it on the server.

Now, let’s assume we have one bug application.

image

when we run the application, start the windbg, click attach to process(F6). then windbg is attached to the buggy application.

load the clr sos extension, and setup to break when there is one clr exception.
image
then the app will stop and breakpoint will be hit whenever there is one .net exception.
image

!pe will show the expcetion.
image

and we can use !clrstack to see the full stacktrace
image

!clrstack –a will show the arguments on each method call

image

besides the sxe, also we can use sxd, sxn and sxi

image

 
Locations of visitors to this page