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

[Breaking change]: RuntimeInformation.RuntimeIdentifier returns platform for which the runtime was built #36466

Closed
1 of 3 tasks
elinor-fung opened this issue Aug 1, 2023 · 2 comments · Fixed by #36992
Closed
1 of 3 tasks
Assignees
Labels
breaking-change Indicates a .NET Core breaking change 📌 seQUESTered Identifies that an issue has been imported into Quest.

Comments

@elinor-fung
Copy link
Member

elinor-fung commented Aug 1, 2023

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

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
  • Behavioral change: Existing binaries may behave differently at run time.

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

@RussKie
Copy link
Member

RussKie commented Aug 1, 2023

Few typos:
image

@elinor-fung
Copy link
Member Author

Thanks. That last sentence there was also impressive - apparently I decided to stop being comprehensible in that section. Fixed.

@gewarren gewarren added the 🗺️ reQUEST Triggers an issue to be imported into Quest. label Sep 5, 2023
@github-actions github-actions bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels Sep 6, 2023
@gewarren gewarren moved this from 🔖 Ready to 👀 In review in dotnet/docs September 2023 sprint Sep 6, 2023
@ghost ghost added the in-pr This issue will be closed (fixed) by an active pull request. label Sep 6, 2023
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in dotnet/docs September 2023 sprint Sep 8, 2023
@ghost ghost removed the in-pr This issue will be closed (fixed) by an active pull request. label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change 📌 seQUESTered Identifies that an issue has been imported into Quest.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants