Skip to content

Persistence fix on app exit/start + Highlight dialog Import/Export error fix - #662

Closed
Pr0metheus2 wants to merge 2 commits into
LogExperts:Developmentfrom
Pr0metheus2:Development
Closed

Pr0metheus2 wants to merge 2 commits into
LogExperts:Developmentfrom
Pr0metheus2:Development

Conversation

@Pr0metheus2

Copy link
Copy Markdown
Contributor

Bug Fix :

  • .lxp persistence on exit when automatic saving and filter-tab restoration are enabled.
  • Save the live filter UI state before shutdown teardown, so FilterParamsList is no longer written empty or stale.
  • Prevent close-time tab disposal from overwriting the already saved snapshot.
    Added:
  • a regression test covering the snapshot behavior.

Bug Fix :
- .lxp persistence on exit when automatic saving and filter-tab restoration are enabled.
- Save the live filter UI state before shutdown teardown, so FilterParamsList is no longer written empty or stale.
- Prevent close-time tab disposal from overwriting the already saved snapshot.
Added:
- a regression test covering the snapshot behavior.
- Fix the Highlight dialog export button by correcting the SaveFileDialog.Filter resource string.
- The filter now uses valid description|pattern pairs, so exporting highlight groups no longer throws an
    ArgumentException.
- Update the localized resources consistently so the export dialog works in all supported languages.
@Pr0metheus2 Pr0metheus2 changed the title Persistence fix on app exit/start Persistence fix on app exit/start + Highlight dialog Import/Export error fix Jul 23, 2026
@Pr0metheus2

Pr0metheus2 commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Seems error on GitHub side? Or how fix it?

image

return snapshot;
}

private FilterParams CaptureCurrentFilterParams ()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Duplicated Code — CaptureCurrentFilterParams() repeats the controls→FilterParams copy shape already present at ~4420–4440 (FilterSearch) and again in the dirty-check at ~4770–4795. Three sites now share the shape; one helper is warranted — though "Surgical Changes" partially excuses not touching the pre-existing sites.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I agree the duplication is real, but I kept this commit "surgical" and only touched the new capture path.

GC.SuppressFinalize(this);
}

private void Dispose (bool disposing)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Duplicated Code / Speculative Generality (tests) — the test fixture implements a full Dispose(bool)/_disposed pattern that duplicates its own TearDown; possibly analyzer-driven (NUnit1032), but the guard-flag pattern is overkill either way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, mostly style noise, but it is not a product bug.

{
SetText("filterComboBox", "LIVE_FILTER_TEXT");
SetText("filterRangeComboBox", "LIVE_RANGE_TEXT");
SetChecked("filterCaseSensitiveCheckBox", true);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Speculative Generality (tests) — SetChecked/SetValue use reflection (GetProperty("Checked")) on controls that could be typed directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Mostly style noise, not a correctness issue.

/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
internal bool SkipPersistenceSaveOnClose { get; set; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Control-flag coupling — LogTabWindow mutates SkipPersistenceSaveOnClose on children before closing them; a Close(savePersistence: false) path would avoid the mutable flag.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agree that a Close(savePersistence: false) would be cleaner. I used the existing flag here to avoid widening the close-path change in this commit and to keep the behavior isolated.

@@ -0,0 +1,166 @@
using System.Reflection;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Added: a regression test covering the snapshot behavior." — Partial. The test covers only the live-UI capture in GatherSessionSnapshot. Neither of the other two claims is tested: nothing exercises "Save the live filter UI state before shutdown teardown" (the ordering in OnLogTabWindowFormClosing), and SkipPersistenceSaveOnClose is never touched by any test.
".lxp persistence on exit/start" — the "start" half has no changes; the restore path (RestoreFilters, [LogWindow.cs:2677] already used FilterParamsList[0], so exit-side changes alone plausibly complete the fix.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right, “exit/start” is only partially backed by tests. The fix is primarily on the save/exit side, not on restore logic.

</data>
<data name="HighlightDialog_UI_Export_Filter" xml:space="preserve">
<value>Settings (*.json)|*.json|All files (*.*)</value>
<value>Settings (*.json)|*.json|All files (*.*)|*.*</value>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a fix for export, not import! Import already has it.

}

SavePersistenceData(false);
if (!SkipPersistenceSaveOnClose)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Prevent close-time tab disposal from overwriting the already saved snapshot." — Works for the guarded path (pre-save runs before RemoveAndDisposeLogWindow, and OnLogWindowClosing at [LogWindow.cs:917] (skips the re-save). But the flag is set-only and never reset — if FormClosing is ever cancelled after the handler runs, surviving windows silently skip persistence on all later manual tab closes. Also Reload() ([LogWindow.cs:7420] and ReloadNewFile() call SavePersistenceData(false) unguarded — a rollover firing mid-shutdown could still overwrite the snapshot. Narrow races, worth noting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Could be a concern. The flag is only set in the app shutdown cascade, immediately before the pre-save and disposal sequence. I don’t see a normal path where it remains active after that close flow completes.
This is relevant if the close cascade aborts or throws before disposal completes. LogTabWindow does swallow these exceptions in its close handler.

/// snapshot after child filter tabs have already been torn down.
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Browsable(false)]/[DesignerSerializationVisibility] on SkipPersistenceSaveOnClose are speculative decoration; LogWindow is never designer-hosted with this property.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It looks unnecessary because this is not a designer-driven surface, but it is harmless metadata, not a correctness issue. I would treat it as cleanup, not a defect. They are not behavior-changing.

@Hirogen

Hirogen commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Seems error on GitHub side? Or how fix it?
image

probably because the github actions cant write on the branch, development branches are normally protected, thats why a separate issue branch should be created and then a PR into the dev branch, to avoid it.

@Pr0metheus2

Pr0metheus2 commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor Author

If you recommend, I can close this pull request and start over again with small individual steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants