runtime
runtime copied to clipboard
RuntimeInformation.OSArchitecture Property is incorrect on Apple M1 chip
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).

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
.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.
Exactly, it prints Arm64 with .NET 6