views:

61

answers:

1

I have a windows service that is, intermittently, throwing an exception that sometimes kills its SQLConnection, and other times kills the service completely. It is running live on a customer's site.

I have planned to use Windbg + SOS on it to get a crash dump, so that I can debug this at my own leisure.

On my first attempt, however, the debugger halted the service when it hit a first chance exception that was being caught and handled in the code (as I used the sxe clr command).

The help file appears to suggest I use sxd clr, instead of sxe clr, to capture second change exceptions instead of first chance exceptions.

In my testing, however, a generated, caught and handled exception is being treated exactly the same as a thrown exception (but not caught) by the sxd clr command, namely it's noted and ignored.

Is this behaviour, of not stopping on a thrown exception, possibly as I threw the exception explicitly in my code, or are will all clr exceptions fail to halt the debugger with the sxd command? Should I be using a different command?

Secondly, As Windbg doesn't specifically recognise clr errors, is it possible to tell it to stop only on a specific, unhandled, exception (i.e. InvalidOperationException)

+1  A: 

It is probably easier just to use adplus for creating the dump file. This article shows how to create minidumps for specific .NET exceptions using adplus.

Brian Rasmussen
Thanks, I'll check it out
johnc
Keep in mind that adplus.vbs was replaced with adplus.exe in the latest version of WinDbg. I have had a few issues with the new version, so you may need to use the old version, which is still included (renamed to adplus_old.vbs).
Brian Rasmussen
Wonderful, thanks
johnc