runtime icon indicating copy to clipboard operation
runtime copied to clipboard

RuntimeInformation.OSArchitecture Property is incorrect on Apple M1 chip

Open blair55 opened this issue 4 years ago • 2 comments

Description

A simple dotnet program prints the value of RuntimeInformation.OSArchitecture.

The program is built and run on an Apple M1 chip (ARM64). However, the output is Architecture.X64 (and not Architecture.Arm64).

image

Reproduction Steps

Build & run using an Apple M1 chip.

using System;
using System.Runtime.InteropServices;

namespace ArchitectureTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine($"{RuntimeInformation.OSArchitecture}");
        }
    }
}

Expected behavior

$ dotnet run
Arm64

Actual behavior

$ dotnet run
X64

Regression?

No response

Known Workarounds

No response

Configuration

$ dotnet --version
5.0.402

$ uname -m
arm64

$ uname -a
Darwin xxxx.lan 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:20 PDT 2021; root:xnu-7195.141.6~3/RELEASE_ARM64_T8101 arm64

Other information

No response

blair55 avatar Jan 17 '22 06:01 blair55

.Net 5 doesn't have a native support for arm64, it works via Rosetta emulation of x64, hence the information you see. Try it with .Net 6.

En3Tho avatar Jan 17 '22 06:01 En3Tho

Exactly, it prints Arm64 with .NET 6

EgorBo avatar Jan 17 '22 09:01 EgorBo