KEMBAR78
Incorrect OS architecture reported for x86 code running on ARM64 · Issue #26612 · dotnet/runtime · GitHub
Skip to content

Incorrect OS architecture reported for x86 code running on ARM64 #26612

@AntonLapounov

Description

@AntonLapounov

When x86 code is executed on an ARM64 Windows, System.Runtime.InteropServices.RuntimeInformation.OSArchitecture returns X86 and System.Environment.Is64BitOperatingSystem returns False. These two properties call GetNativeSystemInfo and IsWow64Process Kernel32.dll functions respectively, which conceal the real OS architecture from x86 code by returning PROCESSOR_ARCHITECTURE_INTEL (meaning x86) and FALSE. To obtain the real OS architecture, Windows 10 introduced a new IsWow64Process2 function in version 1511.

We need to make a decision how an app may reliably figure out the real OS architecture it is running on:
Should we fix the implementation of the existing CoreFX properties?
Or do we recommend resorting to an IsWow64Process2 PInvoke wrapped in a necessary try/catch?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions