Skip to content
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

RuntimeInformation.ProcessArchitecture is a lie on desktop #24146

Closed
MichalStrehovsky opened this issue Nov 15, 2017 · 3 comments
Closed

RuntimeInformation.ProcessArchitecture is a lie on desktop #24146

MichalStrehovsky opened this issue Nov 15, 2017 · 3 comments

Comments

@MichalStrehovsky
Copy link
Member

  1. In Visual Studio 2017, create a new console app targeting .NET Framework 4.7.1 (you might need to grab the targeting pack).
  2. Create a x64 solution configuration and switch to it.
  3. Put this in Main(): Console.WriteLine($"Arch {RuntimeInformation.ProcessArchitecture}, IntPtr.Size: {IntPtr.Size}");
  4. Run the app

Expected result:

Arch X64, IntPtr.Size: 8

Observed result:

Arch X86, IntPtr.Size: 8
@jeremyVignelles
Copy link

Hi,
I have exactly the same issue on .net framework 4.7.
After digging a little with dotPeek, I found that the code executed in GetArchitecture was not the same code as present in this repository.

The parameter int dwOemId is taken as input. By debugging, I see 0 in case of X86 and 9 in case of X64.
Then, the code runs ushort num = (ushort)(dwOemId >> 16);, which turns my 9 into a 0, causing the next code to detect a X86 processor.

How could this be fixed?

@ViktorHofer
Copy link
Member

I don't understand why this is set to 2.1 as it is a bug in netfx? Setting it to future for now.

@MichalStrehovsky
Copy link
Member Author

Fixed in .NET Framework 4.7.2.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants