Repository navigation
refactor: install the exception handler before startup - #983
Merged
Merged
Conversation
The global exception handler is now installed right after the WinForms configuration, before directory and proxy setup, the WebView2 runtime check and the bootstrap. Until the bootstrap services are attached, a fatal exception is saved to the report and shown in the dialog without logging or telemetry, so a startup failure such as an unreadable policy key is no longer silent. A dialog that cannot be shown is logged instead of escaping the handler and ending the process through FailFast.
- Show a plain message box when the task dialog fails, since the types it reads can be the cause of the crash. - Resolve the report folder only when saving, so a failing AppEnvironment initialization still produces a dialog. - Attach the bootstrap services to the exception handler when the context is created and detach them before they are disposed, so a late crash never flushes a disposed telemetry service. A detach releases only the services it attached. - Treat NullTelemetryService as no telemetry, so the dialog does not offer a Send that always fails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The global exception handler is now installed right after the WinForms configuration, before directory and proxy
setup, the WebView2 runtime check and the bootstrap. A failure anywhere in startup, including an unreadable policy
registry key, now produces a saved report and a visible message instead of ending the process silently.
Changes
Programinstalls the handler before every other startup step. Until the bootstrap services exist, a fatalexception is saved to the report and shown in the dialog, without logging, telemetry or the Send button.
BootstrapContextFactoryattaches the logger and telemetry to the handler when it creates the context;BootstrapContextdetaches them before disposing them, so a late crash never uses disposed services. A detachreleases only the services it attached.
error and the report path. The failure is logged once services are attached and no longer ends the process through
FailFast.AppEnvironmentinitialization stillproduces a dialog.
NullTelemetryService, used when telemetry cannot be created, counts as no telemetry: the dialog no longer offers aSend that always fails.
docs/design/diagnostics.md,docs/design/architecture.mdand the consequences of ADR 0003 and ADR 0005 describethe new startup coverage.
Testing
an unavailable report folder and the attachment owned by
BootstrapContext.BRAVO_CrashTest=startup(dialog before the bootstrap, no Send) andBRAVO_CrashTest=ui(dialog after the bootstrap).