SetUnhandledExceptionFilter not always called under Windows 10

SiMoStro 1 Reputation point

We've a mixed application C/C++/.NET which is in the wild for about 15 years now and we use the aforementioned API syscall to install a handler from which, in case of crash, we produce a minidump (MiniDumpWriteDump).

Everything has worked pretty well for years but we noticed a relevant decrease in the reliability of this portion of code first when some of our clients switched to Windows 8.1 and then when (nearly) all switched to Windows 10. It's true that in the meantime other things have changed: the .NET version, we've moved from WinForms to WPF... but a crash should be still a crash and we have to recognize that in many, many case when our clients notifies us an application crash a dump is NOT created (but sometimes is!).

We've also suggested to enable Windows Error Reporting but this didn't help very much, so I was wondering if under Windows 10 this part of error handling and minidump creation had changed so much to make it worth it to use some new alternatives.
Thanks in advance,


Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,168 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,352 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. EckiS 821 Reputation points

    in some error cases the handler is not called, see the comments on:

    I would simple set the registry keys (f.e. in your setup) to let WER write the dump files for you, and remove the unhandled exception filter:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\YourProcessName.exe]

    you can control the writing of the dump file as explained in:

    1 person found this answer helpful.
    0 comments No comments

  2. Limitless Technology 39,181 Reputation points

    Hi there,

    The safest way to handle this problem is to avoid the unhandled exception hook entirely and simply use __try/__except around all of your DLL entry points instead -- a bit of a sledgehammer approach, but a sure way to scope the handling to your own code. Do not use try/catch, as it will not catch non-C++ exceptions in VC8 and up.

    Issuing SetUnhandledExceptionFilter replaces the existing top-level exception filter for all existing and all future threads in the calling process.

    The exception handler specified by lpTopLevelExceptionFilter is executed in the context of the thread that caused the fault. This can affect the exception handler's ability to recover from certain exceptions, such as an invalid stack.

    You can get a look into this forum for more troubleshooting steps

    --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments

  3. SiMoStro 1 Reputation point

    Hi all,

    in these cases we quite regularly suggest out client to disable our internal minidump service (there's a switch for this) and to try to fallback to WER but to be honest also WER pretty often fails to produce the dump.

    Anyway thanks for your feedback, I'll review how we init this and see if I can get something better.


    0 comments No comments