[PR #4505] Initialize Windows Terminal in STA #25799

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

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

State: closed
Merged: Yes


This fixes a crash caused by Narrator starting before terminal.

Fixes #2907.

For context,

// We must initialize the main thread as a single-threaded apartment before
// constructing any Xaml objects. Failing to do so will cause some issues
// in accessibility somewhere down the line when a UIAutomation object will
// be queried on the wrong thread at the wrong time.
// We used to initialize as STA only _after_ initializing the application
// host, which loaded the settings. The settings needed to be loaded in MTA
// because we were using the Windows.Storage APIs. Since we're no longer
// doing that, we can safely init as STA before any WinRT dispatches.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/4505 **State:** closed **Merged:** Yes --- This fixes a crash caused by Narrator starting *before* terminal. Fixes #2907. For context, ``` // We must initialize the main thread as a single-threaded apartment before // constructing any Xaml objects. Failing to do so will cause some issues // in accessibility somewhere down the line when a UIAutomation object will // be queried on the wrong thread at the wrong time. // We used to initialize as STA only _after_ initializing the application // host, which loaded the settings. The settings needed to be loaded in MTA // because we were using the Windows.Storage APIs. Since we're no longer // doing that, we can safely init as STA before any WinRT dispatches. ```
claunia added the pull-request label 2026-01-31 09:11:51 +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#25799