-
Notifications
You must be signed in to change notification settings - Fork 413
Description
Problem
Windows App SDK (WAS) 1.1-preview1 added the ability to ship as part of a self-contained application. What this generally means is that WAS components are now activatable without registration (registration-free WinRT). Instead of relying on registration information stored in the Windows Registry, WAS tooling now/currently stuffs a large manifest into your app replicating that function.
To support this feature outside Visual Studio/Msbuild C++/C#, developers must:
- carefully author this manifest manually (or carry around a generic one and maintain it)
- distribute it with their app internally (as a manifest resource) or externally (my.exe.manifest)
To avoid manifestation altogether, projections such as C++/WinRT and C#/WinRT alternatively turn to a simple algorithm to locate activatable classes and their activation factory. These projections:
- remove the class name (from the fully-qualified class name)
- look for a library with that name
- if that's not found, remove the most-specific segment name and repeat step 2
Unfortunately, WAS does not adhere to best WinRT component naming practices. WAS files have unexpected names and/or host classes that don't have related namespaces.
Here's a snippet of what the class <-> file relationship looks like today:
| Library | Classes |
|---|---|
| Microsoft.WindowsAppRuntime.dll | Microsoft.Windows.ApplicationModel.DynamicDependency.PackageDependency Microsoft.Windows.ApplicationModel.DynamicDependency.PackageDependencyRank Microsoft.Windows.System.EnvironmentManager ... |
| Microsoft.UI.Xaml.dll | Microsoft.UI.Xaml.Controls.DragItemsStartingEventArgs Microsoft.UI.Xaml.Controls.ItemClickEventArgs Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs Microsoft.UI.Xaml.Controls.SemanticZoomViewChangedEventArgs ... |
| Microsoft.UI.Xaml.Controls.dll | Microsoft.UI.Xaml.XamlTypeInfo.XamlControlsXamlMetaDataProvider Microsoft.UI.Xaml.Controls.XamlControlsResources Microsoft.UI.Private.Controls.MUXControlsTestHooks Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusToThicknessConverter Microsoft.UI.Xaml.Controls.Primitives.CornerRadiusFilterConverter ... |
| WinUIEdit.dll | Microsoft.UI.Text.FontWeights Microsoft.UI.Text.TextConstants |
| Microsoft.Web.WebView2.Core.dll | Microsoft.Web.WebView2.Core.CoreWebView2ControllerWindowReference Microsoft.Web.WebView2.Core.CoreWebView2Environment Microsoft.Web.WebView2.Core.CoreWebView2EnvironmentOptions |
| CoreMessagingXP.dll | Microsoft.UI.Dispatching.DispatcherQueue Microsoft.UI.Dispatching.DispatcherQueueController ... |
(The full table, as of 1.1-preview1, can be found here.)
Observe in the above snippet:
Microsoft.WindowsAppRuntime.dllhosts classes in theMicrosoft.Windows.ApplicationModel.*andMicrosoft.Windows.System.*namespaces- Both
Microsoft.UI.Xaml.dllandMicrosoft.UI.Xaml.Controls.dllhost classes in theMicrosoft.UI.Xaml.Controls.*namespace WinUIEdit.dllhosts classes in theMicrosoft.UI.Textnamespace- etc.
I explored the possibility of simply renaming the libraries to compatible names, but Microsoft.UI.dll and Microsoft.UI.Xaml.dll both contain types that would fail the aforementioned search algorithm.
Considered workarounds/solutions
-
Rename all WAS libraries and move the classes to the right spots.
Requires WAS code change. Could be considered a major change (2.0). -
Continue using the internal/external manifest.
This does not follow WinRT component recommendations, is generally non-idiomatic, and is unfriendly for some projections (e.g. Rust). -
Change language projections to deal with non-ideal layout.
Requires all projections to change. Involves working with sensitive projection code.Projections could perhaps:
- consume the manifest (oracle)
- rename the libraries, creating a saner layout, adding numbers to "dupes" (e.g. UI.Xaml.1, UI.Xaml.2, ...)
- adjust activation factory search algorithm as needed
-
Did I miss any?