0

I maintain a 32 bit C++ application that can be run as a user GUI or a windows network service. There is no difference in build, when running as a network service it just doesn't launch the UI.

If the application crashes when running as a GUI, a crash dump is created. However, the same crash running as a service does not create a crash dump.

This is the case for windows 10, server 2012, server 2016.

I have added code to the exception handler so the process can write the dump itself. The registry entry for the dump folder is read successfully and the dump is created in that folder most of the time, but not all. I.e. creating a crash dump in-process seems to be unreliable, which I guess is understandable.

Why would WER not create a dump for an application run as a service?

  • I'm not following. Are you calling `MiniDumpWriteDump` yourself or have you configured WER to do it for you? – IInspectable Sep 24 '20 at 19:40
  • @IInspectable I'm now calling MiniWriteDump because WER doesn't work. MiniWriteDump works most of the time, but fails often enough to be a problem. WER works almost all the time when we run as a GUI, but not at all when as a service, despite being the same executable with the same registry settings. I would like to use WER when running as a service because it seems to be more reliable. – Simian60 Sep 25 '20 at 20:50
  • 1
    You cannot reliably call `MiniDumpWriteDump` from the process you wish to dump. This is irrespective of whether you do so in response to an uncaught exception or otherwise. There is a non-zero chance for a deadlock, unless you move that code to an external process. WER does that. As I recall you need to enable it by setting a registry key to the name of the executable image. When running under a service context the system runs a host process whose executable image no longer matches the one you set in the registry. That said,I don't know how to set up WER for a service. – IInspectable Sep 26 '20 at 08:54
  • Does this answer your question? [Windows does not produce full crash dumps even though registry is set correctly](https://stackoverflow.com/questions/30457570/windows-does-not-produce-full-crash-dumps-even-though-registry-is-set-correctly) – Thomas Weller Oct 10 '20 at 20:31
  • @andI'msureI'mmissingsome Thanks, but I tried everything there before asking. – Simian60 Oct 15 '20 at 07:55

0 Answers0