views:

64

answers:

2

Is there a way to find what exception was caught by .NET code from the outside of the application?

I found that 3d party API throws an exception and suppresses it (I see the perf counter going up).

But it doesnt shows it in trace (I tried sysinternals dbgView).

What tool can show a caught exception?

+1  A: 

Can you attach to the process with the remote debugger in visual studio and have it configured to break when an exception is thrown?

Gary
I am not sure it will break. It is release code and the exception is thrown somewhere in 3d party API code.
Bobb
+1  A: 

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:

  1. File -> Attach to a process (F6)
  2. Select the target process and click 'Open'
  3. 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!)
  4. Run the process until the exception occurs.
  5. 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.

Kevin Pullin
thanks!........
Bobb