locked
.net Windows Service crash RRS feed

  • Question

  • Hi,

    I'm a windows service C++ developer, now I must porting an existing service to C#. I have some questions about investigating on service crash, in particular:

    1) with native service, in case of crash, if drwtsn32 is configured as default postmortem debugger I have a report file and, eventually, a crash dump.

    2) with managed service have I something similar?

    I try to reproduce a crash example with a null pointer use in a service, but I didn't find any information about crash.

    Thanks

    Angelo

    Thursday, April 20, 2006 9:24 AM

Answers

  • You should develop your own reporting and logging logic. You can use the EventLog class for example to use as logging destination.
    Thursday, April 20, 2006 12:19 PM

All replies

  • You should develop your own reporting and logging logic. You can use the EventLog class for example to use as logging destination.
    Thursday, April 20, 2006 12:19 PM
  • This question clearly references crash dumps, which contain a great deal of valuable information that can't be written to the event log.  Minidumps contain a subset of the application's memory including things like the stack for every thread while Dr Watson can be (cautiously) configured to produce a full dump which can later be pulled apart to examine memory structures and all sorts of other goodies using the following tools:

    http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx

    A well written .NET application will have an unhandled exception handler for each application domain which will catch most issues that would trigger a second chance exception, but elusive problems such as heap corruption are difficult to trace without dumps as you don't get the opportunity to write events before the application is taken down.  Other examples include out of memory or stack overflows.

    The following document should help you configure your system up appropriately, overriding the default 'press OK to continue' behaviour.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondebuggingprofiling.asp

    In summary, place the following in a .reg file:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
    "InstallRoot"="C:\\WINDOWS\\Microsoft.NET\\Framework\\"
    "DbgManagedDebugger"="drwtsn32 -p %ld -e %ld -g"
    "DbgJITDebugLaunchSetting"=dword:00000002

    Unfortunately, I am now thwarted by the following issue which I will progress with MS support:

    http://support.microsoft.com/default.aspx?scid=kb;en-us;836080

    Thursday, May 4, 2006 4:49 PM