Run XamlCompiler.exe as ARM64-native on Windows on ARM - #11247
Open
dennisameling wants to merge 1 commit into
Open
Run XamlCompiler.exe as ARM64-native on Windows on ARM#11247dennisameling wants to merge 1 commit into
dennisameling wants to merge 1 commit into
Conversation
XamlCompiler.exe is an AnyCPU / IL-only .NET Framework executable, so on Windows on ARM it launches under x64 emulation by default. Because the XAML compiler dominates WinUI build time, this emulation tax makes ARM64 builds substantially slower than they need to be (see microsoft#11237). Add an application manifest that declares supportedArchitectures "amd64 arm64" and reference it from the project via <ApplicationManifest>. On Windows 11, version 24H2 and later, this lets the loader launch the compiler ARM64-native instead of x64-emulated, without the per-machine Image File Execution Options PreferredMachine registry workaround. Verified on the shipped XamlCompiler.exe binary on Windows 11 ARM64 (measured at image load via GetProcessInformation from an ARM64-native parent): as shipped it launches x64-emulated; with this manifest it launches ARM64-native. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
MSBuild has a builtin flag named |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11237
Problem
XamlCompiler.exeis an AnyCPU / IL-only .NET Framework executable. On Windows on ARM, AnyCPU IL-only images launch under x64 emulation by default. Since the XAML compiler dominates WinUI build time, this emulation tax makes ARM64 builds much slower than they need to be. Issue #11237 measured the compiler at ~76% of build time, and forcing it ARM64-native via a per-machine registry hack gave a ~3.4× compiler speedup.Fix
Declare the native architectures the compiler supports via an application manifest, and reference it from the project:
src/XamlCompiler/Exe/XamlCompiler.manifestwith:Microsoft.UI.Xaml.Markup.Compiler.Executable.csproj:<ApplicationManifest>XamlCompiler.manifest</ApplicationManifest>On Windows 11, version 24H2 and later, the loader then launches the compiler ARM64-native instead of x64-emulated — no per-machine Image File Execution Options
PreferredMachineregistry workaround needed. This was the approach suggested by @driver1998 in the issue.See the
supportedArchitecturesdocumentation.Verification
Measured on the actual shipped
XamlCompiler.exe(from themicrosoft.windowsappsdk.winuipackage — PE32 /ILONLY/ AnyCPU) on Windows 11 ARM64 (build 26200). Architecture read at image-load time viaGetProcessInformation(ProcessMachineTypeInfo)from an ARM64-native parent process (representing the ARM64 build host):XamlCompiler.exeas shipped (nosupportedArchitectures)Notes:
IsWow64Process2is unreliable for detecting x64-on-ARM64 on current builds (it reportsprocessMachine=UNKNOWNfor a verified-x64 image);GetProcessInformation/ Task Manager's Architecture column are the reliable signals.amd64 arm64(rather thanarm64alone) keeps x64 hosts running the compiler x64-native.