Skip to content

Delay load RoMetadata, XmlLite, userenv dlls in WindowsAppRuntime#6398

Merged
Hemantxk merged 1 commit intomainfrom
user/hemakumar/delayLoadMain
Apr 14, 2026
Merged

Delay load RoMetadata, XmlLite, userenv dlls in WindowsAppRuntime#6398
Hemantxk merged 1 commit intomainfrom
user/hemakumar/delayLoadMain

Conversation

@Hemantxk
Copy link
Copy Markdown
Contributor

In a WinUI3 packaged app created from the Visual Studio template, during the auto-initializer phase of WindowsAppRuntime, statically imported DLLs are loaded into memory by default. It is observed that WindowsAppRuntime doesn't call into rometadata.dll, xmllite.dll, and userenv.dll in this phase, but statically imports them. This change delay-loads these three DLLs so they are only loaded when actually needed.

Details

Below is what WindowsAppRuntime uses each of these DLLs for:

  • RoMetadata - WindowsAppRuntime calls into MetaDataGetDispenser in WinRTGetMetadataFile, but it is not called for a WinUI3 packaged app.
  • XmlLite - Used in WinAppSDK to read a package's AppxManifest, but this was not observed being called in a sample launch path. XmlLite can also get loaded by the MUX DLL if someone passes XAML in a string in code-behind (e.g., XamlReader), but this is not a common way to write XAML.
  • userenv - WinAppSDK calls into this DLL for DeriveAppContainerSidFromAppContainerName. This was also not called in the launch path of an app. Browsing through the WinAppSDK code, it is called in GetSecurityDescriptorForAppContainerNames, and not all apps may need it.

Changes

  • dev/WindowsAppRuntime_DLL/WindowsAppRuntime_DLL.vcxproj: Added rometadata.dll, xmllite.dll, and userenv.dll to the linker setting across all build configurations.

@Hemantxk
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@Hemantxk Hemantxk merged commit 01d1033 into main Apr 14, 2026
49 checks passed
@Hemantxk Hemantxk deleted the user/hemakumar/delayLoadMain branch April 14, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants