-
Notifications
You must be signed in to change notification settings - Fork 10.5k
backport(8.0): Fix runtime architecture detection logic in ANCM #63706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR backports a fix for runtime architecture detection logic in the ASP.NET Core Module (ANCM) to the .NET 8.0 branch. The changes replace a simple x86/x64 bitness check with comprehensive processor architecture detection that supports x86, AMD64, and ARM64 architectures.
Key changes:
- Introduces a new
ProcessorArchitecture
enum with proper architecture detection - Replaces binary bitness checking with PE header machine type analysis
- Updates dotnet.exe selection logic to match process architecture instead of just bitness
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
ProcessorArchitecture.h | New header defining processor architecture enum and string conversion utility |
HostFxrResolver.h | Updates method signature from IsX64 to GetFileProcessorArchitecture and adds include |
HostFxrResolver.cpp | Replaces bitness detection with comprehensive architecture matching using PE header analysis |
Environment.h | Adds new method declaration for getting current process architecture |
Environment.cpp | Implements compile-time architecture detection for current process |
@DeagleGross feel free to send the usual mail to tactics for the backport approval. Note -- there is some precedent for holding off on backports until they've had some bake time in main. Or even, take the 9.0 backport but delay the 8.0 backport a month or two. It's really a risk decision. Your judgement. |
Description
Backport of #63652 to net8.0
A change (#61894) improved algorithm to determine the architecture of a binary by switching away from
GetBinaryTypeW
(which seems to load the exe into executable space which might trigger custom windows policies). It was backported to net8.0: #62037.However, we spotted that sometimes function incorrectly chooses a binary of an incompatible architecture, resulting in crashing site load.
Current change specifically checks for a full compatibility of bitness and architecture.
Fixes #63650
Customer Impact
For example users hosting x86 app on x64 machine / x64 app on arm64 machine are impacted unless current change is merged and used.
Regression?
Risk
Impacts users who are using different process architecture then what
where.exe
outputs trying to find dotnet binary. It takes OS / process / dotnet arch installed combination to affect the behavior.Verification
Packaging changes reviewed?