This is the ThreadExceptionDialog class, it comes from the Form class. The conclusion from it, to change the dialogue, is a lost reason, you can not easily get to the built-in controls. You can create your own custom derived class to create your own dialog, just give it a constructor that takes an Exception argument. Add an event handler for Application.ThreadException to display it.
Note the fundamental flaw in the dialog box. He expects the user to make the right choice when she needs to click a button to close the dialog box. All in all, pretty obscure information about what exactly went wrong. This means something to you, rarely something more than “oh shit” to the user. Clicking the Continue button is usually not suitable for proper operation.
To prevent the user from making such a difficult choice, call Application.SetUnhandledExceptionMode () in your Main () method, passing ThrowException so that the event never raises. Each unhandled exception now occurs through an AppDomain.UnhandledException. Including those that were raised in the workflow, exceptions that do not create a dialog. Write an event handler for it and display and / or write the value of e.ExceptionObject.ToString (). It is up to you to get information to your desktop or user IT staff so that you can improve your product and they can ensure the stability of their machines.
Hans passant
source share