[PR #15628] Lazily load the settings UI DLL #30690

Closed
opened 2026-01-31 09:42:21 +00:00 by claunia · 0 comments
Owner

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

State: closed
Merged: Yes


Due to an implementation detail in the Xaml compiler--which wants to ensure that all metadata providers on an App are available immediately--we were eagerly loading the settings UI DLL and all of its dependencies, even in sessions where the user was not going to open Settings.

By turning off eager provider generation and handling it ourselves, we get to control exactly when the settings UI is loaded.

This required some gentle poking-through of the barrier between App and Page, but it is almost certainly worth it.

Turning on the Xaml code generation flag to not generate providers automatically adds an AddProvider member to the internal interface for the autogenerated XamlMetadataProvider. We needed to switch to using the internal interface rather than the projected type in our custom App base class to get at it.

Providers that App/Page use must be initialized by the time we start the WindowsXamlManager, so we load Control and Controls (ha) eagerly and early.

It looks like it may save 400ms of CPU time (?) on startup.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/15628 **State:** closed **Merged:** Yes --- Due to an implementation detail in the Xaml compiler--which wants to ensure that all metadata providers on an App are available immediately--we were eagerly loading the settings UI DLL and all of its dependencies, even in sessions where the user was not going to open Settings. By turning off eager provider generation and handling it ourselves, we get to control exactly when the settings UI is loaded. This required some gentle poking-through of the barrier between App and Page, but it is almost certainly worth it. Turning on the Xaml code generation flag to not generate providers automatically adds an `AddProvider` member to the internal interface for the autogenerated XamlMetadataProvider. We needed to switch to using the internal interface rather than the projected type in our custom App base class to get at it. Providers that App/Page use must be initialized by the time we start the WindowsXamlManager, so we load Control and Controls (ha) eagerly and early. It looks like it may save 400ms of CPU time (?) on startup.
claunia added the pull-request label 2026-01-31 09:42:21 +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#30690