You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RuntimeInformation.OSArchitecture returns X64 unexpectedly on arm64-Windows system #130398
I tested again and observed different behavior under different conditions:
If launched via F5 under VS, it reports OS as x64:
If launched via Ctrl+F5, or double clicking directly, it reports OS as ARM64:
There may be more detail that I missed. This repo is not the best place to ask .NET Framework-specific questions. You can ask at Visual Studio Developer Community and the developers may answer you the behavior behind.
Anyway, the ARM64 emulator tend to hide itself for processes that's non-native ARM64.
// If we are running an x64 process on a non-x64 windows machine, we will report x64 as OS architecture.
Closing as by design.
I would assume that to be a bug still, or the code was written before the API to detect that was added in build 22000. @jkotas Would it make sense to prefer GetProcessInformation with ProcessMachineTypeInfo there? AFAIR it's always accurate unlike IsWowProcess2.
Activity
dotnet-policy-service commentedon Jul 9, 2026
Tagging subscribers to this area: @dotnet/area-system-console
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Jul 9, 2026
Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.
huoyaoyuan commentedon Jul 9, 2026
RID is not applicable to .NET Framework. .NET Framework produces AnyCPU exe and switches architecture via manifest configuration.
The default for .NET Framework on ARM64 is always x64 emulation, which emulates a full x64 system. You can print
ProcessArchitectureto confirm.To change the behavior, you can set following properties in csproj:
<PreferNativeArm64>true</PreferNativeArm64>ProcessArchitecture: ARM64 OSArchitecture: ARM64
Process runs with native arm64.
<Prefer32Bit>true</Prefer32Bit>ProcessArchitecture: x86 OSArchitecture: ARM64
Process runs with x86 emulation.
ProcessArchitecture: x64 OSArchitecture: x64
Process runs with x64 emulation.
huoyaoyuan commentedon Jul 9, 2026
The comment of .NET 10 also intentionally reports x64 OS for emulated x64:
runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeInformation.Windows.cs
Line 42 in 75fa507
Closing as by design.
JensNordenbro commentedon Jul 9, 2026
Hmm...
@huoyaoyuan , I dont think this exaplains it all.
I get this scenario inside Windows Sandbox (on the host it works correctly) :
This time I built using .NET Framework SDK more true to the scenario of our real world application that experiences problem.
How is this explained?
huoyaoyuan commentedon Jul 9, 2026
I tested again and observed different behavior under different conditions:
If launched via F5 under VS, it reports OS as x64:
If launched via Ctrl+F5, or double clicking directly, it reports OS as ARM64:
There may be more detail that I missed. This repo is not the best place to ask .NET Framework-specific questions. You can ask at Visual Studio Developer Community and the developers may answer you the behavior behind.
Anyway, the ARM64 emulator tend to hide itself for processes that's non-native ARM64.
JensNordenbro commentedon Jul 9, 2026
I would say, that this is a bug.
Sandbox should not behave differently than host machine.
Then again it might not be for this repo but notice that this behavior is true when .NET SDK is used to target net481 so...
huoyaoyuan commentedon Jul 9, 2026
SDK is totally unrelated to the behavior. It just sets corresponding flag/manifest and lets the runtime/OS to determine the behavior.
Further issues should be reported to Developer Community.
AaronRobinsonMSFT commentedon Jul 9, 2026
Correct. Since this issue is specifically about .NET Framework, regardless of how it is compiled, it should be reported at https://developercommunity.visualstudio.com/home.
JensNordenbro commentedon Jul 9, 2026
It is reported at https://developercommunity.visualstudio.com/t/RuntimeInformationOSArchitecture-return/11118748
MichalPetryka commentedon Jul 10, 2026
I would assume that to be a bug still, or the code was written before the API to detect that was added in build 22000.
@jkotas Would it make sense to prefer GetProcessInformation with
ProcessMachineTypeInfothere? AFAIR it's always accurate unlikeIsWowProcess2.huoyaoyuan commentedon Jul 10, 2026
The comment looks outdated. Tested on my Surface, x86 and x64 processes will both get OSArchitecture=ARM64 on .NET 10.
Found the breaking change announcement for .NET 7:
https://learn.microsoft.com/en-us/dotnet/core/compatibility/interop/7.0/osarchitecture-emulation
MichalPetryka commentedon Jul 10, 2026
Ah wait I remembered incorrectly, it was the
pProcessMachinethat was wrong inIsWowProcess2, thepNativeMachineis correct.Remove outdated comment in OSArchitecture (#130461)
Remove outdated comment in OSArchitecture (#130461)