Description
RuntimeInformation.RuntimeIdentifier will return the platform for which the runtime was built, rather than a value computed at run time.
PR: dotnet/runtime#89598
Related:
Version
.NET 8 RC 1
Previous behavior
The value was a RID computed via OS files and/or APIs. This generally meant it was a version-specific and distro-specific RID. For example, when running an application on Windows 11, it would be win10-x64 or on Ubuntu 20.04, it could be ubuntu.20.04-x64.
New behavior
The value is the RID for which the runtime was built. This means that for portable builds of the runtime (all Microsoft-provided builds), it will be non-version-specific and non-distro-specific. For example, when on Windows 11, it would be win-x64 or on Ubuntu 20.04, linux-x64. For non-portable builds (source-build), the build sets a build RID at that can have a version/distro and that value is the RID for the runtime will return.
Type of breaking change
Reason for change
This is in line with a .NET 8 change to RID-specific asset resolution and the move away from a distro-aware runtime. RuntimeInformation.RuntimeIdentifier is an opaque value that should represent the platform on which the host/runtime considers itself to be running. In .NET 8, that corresponds to the platform for which the host/runtime is built, rather than a RID computed at run time.
Recommended action
RuntimeInformation.RuntimeIdentifier is an opaque value and not intended to be parsed into its component parts. For the OS version of the actual machine an application is running on, Environment.OSVersion can be used. For a description, RuntimeInformation.OSDescription can be used. For a specific ID (distro) and corresponding version on Linux, users would have to read the os-release file.
Feature area
Core .NET libraries
Affected APIs
RuntimeInformation.RuntimeIdentifier
Associated WorkItem - 156743
Description
RuntimeInformation.RuntimeIdentifierwill return the platform for which the runtime was built, rather than a value computed at run time.PR: dotnet/runtime#89598
Related:
Version
.NET 8 RC 1
Previous behavior
The value was a RID computed via OS files and/or APIs. This generally meant it was a version-specific and distro-specific RID. For example, when running an application on Windows 11, it would be
win10-x64or on Ubuntu 20.04, it could beubuntu.20.04-x64.New behavior
The value is the RID for which the runtime was built. This means that for portable builds of the runtime (all Microsoft-provided builds), it will be non-version-specific and non-distro-specific. For example, when on Windows 11, it would be
win-x64or on Ubuntu 20.04,linux-x64. For non-portable builds (source-build), the build sets a build RID at that can have a version/distro and that value is the RID for the runtime will return.Type of breaking change
Reason for change
This is in line with a .NET 8 change to RID-specific asset resolution and the move away from a distro-aware runtime.
RuntimeInformation.RuntimeIdentifieris an opaque value that should represent the platform on which the host/runtime considers itself to be running. In .NET 8, that corresponds to the platform for which the host/runtime is built, rather than a RID computed at run time.Recommended action
RuntimeInformation.RuntimeIdentifieris an opaque value and not intended to be parsed into its component parts. For the OS version of the actual machine an application is running on,Environment.OSVersioncan be used. For a description,RuntimeInformation.OSDescriptioncan be used. For a specific ID (distro) and corresponding version on Linux, users would have to read the os-release file.Feature area
Core .NET libraries
Affected APIs
RuntimeInformation.RuntimeIdentifierAssociated WorkItem - 156743