[PR #4429] Don't crash when the user tries to duplicate a tab with a profile that no longer exists #25758

Open
opened 2026-01-31 09:11:37 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/4429

State: closed
Merged: No


Summary of the Pull Request

When the user tries to duplicateTab with a profile that doesn't exist anymore (like might happen after a settings reload), don't crash.

PR Checklist

  • Closes Install without Windows Store (#2455)
  • I work here
  • Tests added/passed
  • [n/a] Requires documentation to be updated
  • Should we display an error dialog when this situation happens?
    • Should this be a follow-up task?

Detailed Description of the Pull Request / Additional comments

CascadiaSettings::BuildSettings can throw if the GUID doesn't exist. This wraps those calls up with a try/catch.

It also adds a couple tests - a few SettingsTests for try/catching this state. It also adds a XAML-y test in TabTests that creates a TerminalPage and then performs som UI-like actions on it. This test required a minor change to how we generate the new tab dropdown - in the tests, Application::Current() is not a TerminalApp::App, so it doesn't have a Logic() to query. So wrap that in a try/catch as well.

Validation Steps Performed

  • Ran tests - new tests pass!
  • Validated scenario manually
**Original Pull Request:** https://github.com/microsoft/terminal/pull/4429 **State:** closed **Merged:** No --- ## Summary of the Pull Request When the user tries to `duplicateTab` with a profile that doesn't exist anymore (like might happen after a settings reload), don't crash. ## PR Checklist * [x] Closes #2455 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated * [ ] Should we display an error dialog when this situation happens? - Should this be a follow-up task? ## Detailed Description of the Pull Request / Additional comments `CascadiaSettings::BuildSettings` can throw if the GUID doesn't exist. This wraps those calls up with a try/catch. It also adds a couple tests - a few `SettingsTests` for try/catching this state. It also adds a XAML-y test in `TabTests` that creates a `TerminalPage` and then performs som UI-like actions on it. This test required a minor change to how we generate the new tab dropdown - in the tests, `Application::Current()` is _not_ a `TerminalApp::App`, so it doesn't have a `Logic()` to query. So wrap that in a try/catch as well. ## Validation Steps Performed * Ran tests - new tests pass! * Validated scenario manually
claunia added the pull-request label 2026-01-31 09:11:37 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#25758