This API is now emitting a valid version in alignment with
https://github.com/dotnet/runtime/issues/28788.
---------
Co-authored-by: Stephen Toub <stoub@microsoft.com>
[Obsolete(Obsoletions.RuntimeEnvironmentMessage, DiagnosticId = Obsoletions.RuntimeEnvironmentDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
public static object GetRuntimeInterfaceAsObject(Guid clsid, Guid riid) => throw new PlatformNotSupportedException();
- public static string GetSystemVersion() => typeof(object).Assembly.ImageRuntimeVersion;
+ public static string GetSystemVersion() => $"v{Environment.Version}";
}
}
[Fact]
public void RuntimeEnvironmentSysVersion()
{
- Assert.NotEmpty(RuntimeEnvironment.GetSystemVersion());
+ // The historical format of this API is "vX.Y.Z", so we validate and retain that.
+ Assert.Equal($"v{Environment.Version}", RuntimeEnvironment.GetSystemVersion());
}
#pragma warning disable SYSLIB0019 // RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are no longer supported and throw PlatformNotSupportedException.