I have a dotnet windows service that's currently hung, but running. Is there anyway to attach a debugger to it, despite the lack of symbols; and that it's already running?
3 Answers
Ignore the "no symbols" warning. Once you have a native debugger attached (i prefer WinDbg for stuff like this), then load up the SoS tool pack:
.loadby sos mscorwks
Now you can get a managed callstack using the !clrstack
command, and hope that gives you enough information to figure out the hang. Here's a handy cheat-sheet with a few others if that doesn't do it for you.
Won't help you this time, but... get in the habit of turning on symbol file generation for debug and release-mode builds. There's no reason not to, and it'll make your life a bit easier in situations like this.

- 21,988
- 13
- 81
- 109

- 156,901
- 35
- 231
- 235
-
I just want to second that you should be doing symbol file generation for debug and release builds. – LanceSc Dec 18 '08 at 00:15
From MS dev IDE Debug -> Processes -> Attach (After you choose a process.) You might have to click the "show system processes" box. There may be no useful information though...

- 20,184
- 24
- 117
- 214
-
-
And yes you can list a service that way as long as it's in its own process. – Orion Adrian Dec 17 '08 at 21:51
-
If there are no symbols, yes. But if you want to step through the assembler code you can. – Tim Dec 17 '08 at 21:52
-
This would be a good idea for a compiled exe where you could get a stack trace and link the it to somewhere in the original code, but I can't see what usable info he could get from a "jit" compiled .net app (just guessing here, I never tried it so correct me if I'm wrong) – Hrvoje Prgeša Dec 17 '08 at 21:58
Here is sample code, links to tools, and presentations on how to debug a hung .NET process.
You probably also want to watch this video presentation, which features the same tools and samples. Despite the Swedish text on the web page, the video is in English.

- 125,891
- 12
- 252
- 273