Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Windows critical error handler #5828

Merged
merged 1 commit into from Feb 12, 2024
Merged

Conversation

dra27
Copy link
Member

@dra27 dra27 commented Feb 11, 2024

When the WIndows loader cannot find DLLs, the default, very very legacy behaviour is to display a dialog such as this:

image

This dialog is problematic, as it's part of the loader, so the application itself is not able to handle this itself. It's doubly problematic for us, as it's blocking.

The convention is that calling applications are expected to disable this error handler. New processes inherit this setting, which causes the loader to suppress the dialog box and instead return an exit code. This is documented best practice (see the notes for SEM_FAILCRITICALERRORS in SetErrorMode on MSDN).

In particular, this suppresses the "execution cannot proceed because
X.dll was not found" dialog, instead returning an exit code.

Calling this at program startup is already recommended best practice for
Windows applications.
@dra27 dra27 added this to the 2.2.0~beta2 milestone Feb 11, 2024
@dra27 dra27 added this to For beta2 in Opam 2.2.0 Feb 11, 2024
@rjbou rjbou self-requested a review February 12, 2024 13:20
Copy link
Collaborator

@rjbou rjbou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no simple way to have more information on the missing DLL, lgtm! thanks

@dra27 dra27 merged commit 55d45ad into ocaml:master Feb 12, 2024
29 checks passed
Opam 2.2.0 automation moved this from For beta2 to Done Feb 12, 2024
@dra27
Copy link
Member Author

dra27 commented Feb 12, 2024

Let's get it merged before that screenshot of the dialog grows any further!

@dra27 dra27 deleted the critical-errors branch February 12, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Opam 2.2.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants