NOTE: This is not a duplicate of Is there a setting that is preventing the unhandled exception dialog from displaying in apps that I compile? because that post is asking the opposite question (how to get the dialog I want to eliminate) and the answers provided, although they provide some pertinent information to my question, it does not answer the question which is how do I get my application to create a crash dump when an unhandled exception is thrown from a Windows Form Event.
Why on earth would anyone want there users to see this dialog is beyond me.
But that's besides the point of this post. How do I get my application to produce a crash dump instead? I can't figure it out.
EDIT: Let's say for example, my executable is myapplication.exe. When it crashes I want WERFAULT.EXE to handle it so it will create a crash dump that my customers can send me so I can investigate the problem. If I throw an unhandled exception from one of my threads I get a crash dump. But when I throw an unhandled exception from within a Windows Form event the dialog above is shown.
I created a myapplication.exe.config file and entered the following as directed at the bottom of the details of this dialog.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
And I put the myapplication.exe.config file in my installation directory besides my application.exe file.
Now the application just goes away. No crash dump, even though I have my registry configured to create crash dumps. As directed here.
In my installer I create the necessary registry changes to force my application to create crash dumps. In
HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\myapplication.exe
registry key I set DumpType to 2, DumpFolder to our application data directory and DumpCount to 1. But process just goes away and no crash dump is created.
I know the machine is configured to create crash dumps correctly because I can add code to other applications to make them crash and crash dumps get created correctly.
EDIT: If I added to my main entry point Application.SetUnhandledExceptionMode to UnhandledExceptionMode.ThrowException I don't get the dialog, but the process just goes away. No crash dump.