The tool I always turn to in this situation is WinDBG. Download the 32bit version or the 64bit version, depending on the bitness of the process.
For some lame reason the latest version does not have a direct download link (only available in the SDK), so skip down to the 'Previous Version' section and grab the latest of those.
Load WinDBG after installing and do the following:
- File -> Attach to a process (F6)
- Select the target process and click 'Open'
- In the console enter the following:
.loadby sos mscorwks
(this loads the .NET debugger extensions)
sxe clr
(tells the debugger to break on managed exceptions)
g
(GO!)
- Run the process until the exception occurs.
- The debugger will break, at which time enter
!pe
to see the exception details.
The !clrstack
command is useful to see the managed stack or try !dumpstack
to include native calls.
If the debugger stops on an exception you don't care about, just hit 'g' again until you get the one you want to see.
The !help
command will show all the .NET extensions available and, if you wish to dig deeper, I highly recommend Tess Ferrandez's blog.