-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Description
I am updating a NET Standard 2.0 library to .NET 8 packages due to vulnerabilities in .NET Core 2.1 dependencies.
The project involves cross-platform library loading, and under .NET Core 2.1 it relied upon GetRuntimeIdentifier()
to determine the RID. There was a breaking change to RID usage in .NET 8. Since I'm not currently equipped to test cross-platform functionality, I wanted to use the <UseRidGraph>
workaround to revert to the old functionality.
However, the API also changed and now I must read the RuntimeInformation.RuntimeIdentifier
property (same page as the "workaround" link above) instead of calling GetRundtimeIdentifier()
.
Unfortunately that property doesn't appear to be provided even though the docs say it is part of netstandard.dll
:

Reproduction Steps
Create a .NET Standard 2.0 class library.
Modify the csproj to add UseRidGraph:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Issue_RuntimeIdentifier</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<UseRidGraph>true</UseRidGraph>
</PropertyGroup>
</Project>
Reference the property in code:
using System.Runtime.InteropServices;
namespace Issue_RuntimeIdentifier
{
public class Class1
{
public string GetRID()
=> RuntimeInformation.RuntimeIdentifier;
// ^^ CS0117: 'RuntimeInformation' does not contain a definition for 'RuntimeIdentifier'
}
}
Expected behavior
RuntimeIdentifier
property should exist.
Actual behavior
CS0117: 'RuntimeInformation' does not contain a definition for 'RuntimeIdentifier'
Regression?
Unknown if this is a regression.
Known Workarounds
No known workaround.
Configuration
.NET 8 (whatever is current) ... don't think other details are likely relevant.
Other information
I don't think it'll help much, but you can see the code in context here.
Metadata
Metadata
Assignees
Type
Projects
Status