File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/BenchmarkDotNet/Portability Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,15 @@ internal static class RuntimeInformation
31
31
[ PublicAPI ]
32
32
public static bool IsNetNative => FrameworkDescription . StartsWith ( ".NET Native" , StringComparison . OrdinalIgnoreCase ) ;
33
33
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 ) ;
35
37
36
38
/// <summary>
37
39
/// "The north star for CoreRT is to be a flavor of .NET Core" -> CoreRT reports .NET Core everywhere
38
40
/// </summary>
39
41
public static bool IsCoreRT
40
- => FrameworkDescription . StartsWith ( ".NET Core" , StringComparison . OrdinalIgnoreCase )
42
+ => ( ( Environment . Version . Major >= 5 ) || FrameworkDescription . StartsWith ( ".NET Core" , StringComparison . OrdinalIgnoreCase ) )
41
43
&& string . IsNullOrEmpty ( typeof ( object ) . Assembly . Location ) ; // but it's merged to a single .exe and .Location returns null here ;)
42
44
43
45
public static bool IsRunningInContainer => string . Equals ( Environment . GetEnvironmentVariable ( "DOTNET_RUNNING_IN_CONTAINER" ) , "true" ) ;
You can’t perform that action at this time.
0 commit comments