Record Avalonia UI mode in crash reports - #1066
Open
johnml1135 wants to merge 3 commits into
Open
Conversation
Add the persisted UIMode and UIModeDisabledTools values to the ErrorReporter property bag alongside the other environment info, so a crash report shows whether Avalonia UI was active and which tools opted out, without duplicating anything the trace covers.
Assert that SeedUIModeProperties records AvaloniaUIMode and AvaloniaDisabledTools on ErrorReporter, so a regression in that wiring surfaces as a test failure instead of only in a real crash report.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1066 +/- ##
=======================================
Coverage 38.04% 38.05%
=======================================
Files 1499 1499
Lines 350108 350114 +6
Branches 40231 40232 +1
=======================================
+ Hits 133216 133238 +22
+ Misses 187607 187593 -14
+ Partials 29285 29283 -2
🚀 New features to boost your workflow:
|
Contributor
|
As you mention, this records the values only at startup. This would be confusing if a value is changed. I think we should update the error report properties when the values change. If that is too much effort for this PR, I suggest renaming the error report properties to "...AtStartup" until the update is implemented. I would find this PR easier to review if the description were more concise. I learned nothing by reading the second sentence, the second paragraph, and the "Where to look" section. |
Addresses review feedback on PR #1066: AvaloniaUIMode and AvaloniaDisabledTools only reflected the values seeded at window construction, so a crash after an in-session UI-mode toggle showed the stale startup values instead of what was active at crash time. LexOptionsDlg.m_btnOK_Click and the new AvaloniaOptionsDialogLauncher ApplyUiModeLive/ApplyDisabledToolsLive helpers now call ErrorReporter.AddProperty alongside the existing PropertyTable broadcast, so the crash-report value tracks every live change instead of only the initial seed. Covered by new tests in LexOptionsDlgTests and AvaloniaOptionsDialogLauncherTests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Author
|
Thanks -- both addressed in aa06e67:
|
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.
Crash reports now record whether Avalonia ("New") UI mode is active and
which tools are opted out via
UIModeDisabledTools, alongside the OS/.NETenvironment info
ErrorReporteralready collects. That value tracks thewhole session, not just the moment the window opened: toggling UI mode from
either Options dialog updates the crash-report property the same instant it
updates the
PropertyTable.The reviewer question this needs to answer up front is "is the recorded
value trustworthy, and does it stay that way?" The first version of this
branch seeded the value once at window construction and left it there for
the rest of the session -- review feedback flagged that a crash right after
an in-session Legacy<->New toggle would still show the stale startup mode.
This revision closes that gap rather than just labeling it: both Options
dialogs now push the same update into
ErrorReporterthat they already pushinto the
PropertyTable.Where to look
FwXWindow.SeedUIModeProperties-- the startup seed; twoErrorReporter.AddPropertycalls using the exactNormalizeUIModeoutputalready written to the
PropertyTabletwo lines above.LexOptionsDlg.m_btnOK_Click(WinForms) andAvaloniaOptionsDialogLauncher.ApplyUiModeLive/ApplyDisabledToolsLive(Avalonia) -- both live-toggle paths now call
ErrorReporter.AddPropertyright alongside their existing
PropertyTablebroadcast.ApplyUiModeLive/ApplyDisabledToolsLivemoved fromprivatetointernal staticso they are unit-tested directly, the same patternFwXWindowUIModeSeedingTestsalready used for the seed path.FwXWindowUIModeSeedingTests,LexOptionsDlgTests,AvaloniaOptionsDialogLauncherTests-- all assert directly againstSIL.Reporting.ErrorReport.Properties, not just thePropertyTable.Deliberately not here
LexOptionsDlg(WinForms) has no per-tool disabled-tools editor, so onlyAvaloniaUIModeneeds a live update there;ApplyDisabledToolsLiveexistsonly on the Avalonia side, where that setting is actually edited.
Standalone branch off
main, not stacked../build.ps1and the threetargeted
test.ps1runs above are clean on a fresh worktree (8 + 46 tests,all passed). Full repo
test.ps1was not run.Reading this a year from now -- start here
This PR is small enough that no research or working notes were produced or
deleted for it. The one thing worth knowing later: the crash-report value
was seed-only in the first version of this branch and was made live in
response to review feedback -- see "Decisions, and why" below.
Decisions, and why
Seed once, then keep it live, rather than accept staleness. The first
version of this branch recorded
AvaloniaUIMode/AvaloniaDisabledToolsonly in
FwXWindow.SeedUIModeProperties, at window construction. That was adeliberate first cut: seed-time coverage costs nothing extra (the value
already exists at that point), and most crashes happen without a mid-session
mode toggle. Review feedback pointed out the failure mode this leaves: a
crash immediately after toggling UI mode shows the mode active at startup,
not at crash time. Rather than rename the properties to admit the staleness
(
...AtStartup), this revision wires the two places that already broadcasta live toggle --
LexOptionsDlg.m_btnOK_ClickandAvaloniaOptionsDialogLauncher's apply path -- to also callErrorReporter.AddProperty, so the crash-report value is exactly as freshas the
PropertyTablevalue it mirrors.internal static, notprivate, for the two Avalonia apply helpers.ApplyUiModeLiveand the newApplyDisabledToolsLiveareinternal static-- visible viaInternalsVisibleTo, the same mechanismNormalizeUiMode/ShouldApplyWritingSystemChangealready use in this file-- so
AvaloniaOptionsDialogLauncherTestscan exercise the crash-reportside effect directly, without standing up a full
LcmCache/mediator/Applycall.
Property names.
AvaloniaUIModeandAvaloniaDisabledToolswere pickedto read clearly in a raw crash-report text dump next to the existing flat
Key: valuediagnostic lines (OSVersion,MachineName, etc.) -- not tomirror the internal
UIMode/UIModeDisabledToolsPropertyTablekeynames, which would be ambiguous out of context to a support engineer reading
a report without the surrounding code.
Evidence
./build.ps1succeeds on a fresh worktree offorigin/main../test.ps1 -TestProject "Src/xWorks/xWorksTests" -TestFilter "FwXWindowUIModeSeedingTests"--Test Run Successful. Total tests: 8../test.ps1 -TestProject "Src/LexText/LexTextControls/LexTextControlsTests" -TestFilter "LexOptionsDlgTests|AvaloniaOptionsDialogLauncherTests"--Test Run Successful. Total tests: 46, including the two new testsasserting
ErrorReport.Properties["AvaloniaUIMode"]and["AvaloniaDisabledTools"]after a live toggle.OkClick_LeavesLegacyWhenUserDoesNotChangeSelectionadditionally assertsthe crash-report property stays unset when the user does not change the
mode, so an unrelated OK-click cannot fabricate a value.
This change is