Log crashes and tell the user instead of vanishing - #167
Merged
Merged
Conversation
An unhandled exception closed the clock with no message, leaving only an entry in Event Viewer. Now the first one, on the UI thread or a background thread like the clock's timer, is appended to DesktopClock.log next to the app (or in the temp folder if that one can't be written to) with the time, version, Windows and .NET versions, and the stack trace. A message says where the log is and where to report it, then the app exits, since carrying on in an unknown state could leave a clock that looks fine but has stopped. A second crash while that's happening exits right away instead of stacking dialogs, and the log starts over past 1 MB.
Settings are saved a second after they change, so a crash within that second lost the last change. The crash handler now saves them first if they were loaded and can be saved, ignoring any error so it never gets in the way of logging. A setting changed 0.3 seconds before a crash is kept now.
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.
An unhandled exception used to close the clock with no message, leaving only a
.NET Runtimeentry in Event Viewer. Now the first one, on the UI thread or a background thread like the clock's timer:DesktopClock.lognext to the app (named after the exe, like the settings file), or to%TEMP%if that folder can't be written to. Each entry has the time, app version, Windows and .NET versions, and the full stack trace. The log starts over past 1 MB.A second crash while that's happening exits right away instead of stacking dialogs. No telemetry, uploads, dumps, or auto-restart.
Tested by running the real
App(including itsOnStartupregistration) andMainWindowin-process and forcing crashes:0xE0434352, no log, setting changed 0.3 s earlier lost%TEMP%, message shows that pathA normal run creates no log, and the usual smoke test passes (launch, live reload, save on exit). The message text will need keys when the localization branch lands.