Search code examples
.netwindows-servicesdebuggingrelease-mode

Is there a way to debug an already running application compiled in release mode?


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?


Solution

  • 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.