Skip to content

[1.8 servicing] Delay load RoMetadata, XmlLite, userenv dlls in WindowsAppRuntime#6401

Open
Hemantxk wants to merge 1 commit intorelease/1.8-stablefrom
user/hemakumar/delayLoad
Open

[1.8 servicing] Delay load RoMetadata, XmlLite, userenv dlls in WindowsAppRuntime#6401
Hemantxk wants to merge 1 commit intorelease/1.8-stablefrom
user/hemakumar/delayLoad

Conversation

@Hemantxk
Copy link
Copy Markdown
Contributor

Cherry-picked from #6398

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).

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.

1 participant