Skip to content

Commit 465ebf3

Browse files
authored
React to .NET 5 branding changes (#1399)
* React to .NET 5 branding changes
1 parent 9a251a3 commit 465ebf3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/BenchmarkDotNet/Portability/RuntimeInformation.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ internal static class RuntimeInformation
3131
[PublicAPI]
3232
public static bool IsNetNative => FrameworkDescription.StartsWith(".NET Native", StringComparison.OrdinalIgnoreCase);
3333

34-
public static bool IsNetCore => FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(typeof(object).Assembly.Location);
34+
public static bool IsNetCore
35+
=> ((Environment.Version.Major >= 5) || FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase))
36+
&& !string.IsNullOrEmpty(typeof(object).Assembly.Location);
3537

3638
/// <summary>
3739
/// "The north star for CoreRT is to be a flavor of .NET Core" -> CoreRT reports .NET Core everywhere
3840
/// </summary>
3941
public static bool IsCoreRT
40-
=> FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase)
42+
=> ((Environment.Version.Major >= 5) || FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase))
4143
&& string.IsNullOrEmpty(typeof(object).Assembly.Location); // but it's merged to a single .exe and .Location returns null here ;)
4244

4345
public static bool IsRunningInContainer => string.Equals(Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER"), "true");

0 commit comments

Comments
 (0)