@@ -42,8 +42,6 @@ internal static class RuntimeInformation
4242 FrameworkDescription . StartsWith ( ".NET Framework" , StringComparison . OrdinalIgnoreCase ) ;
4343#endif
4444
45- public static readonly bool IsNetNative = FrameworkDescription . StartsWith ( ".NET Native" , StringComparison . OrdinalIgnoreCase ) ;
46-
4745#if NET6_0_OR_GREATER
4846 [ System . Runtime . Versioning . SupportedOSPlatformGuard ( "browser" ) ]
4947 public static readonly bool IsWasm = OperatingSystem . IsBrowser ( ) ;
@@ -52,7 +50,7 @@ internal static class RuntimeInformation
5250#endif
5351
5452#if NETSTANDARD2_0
55- public static readonly bool IsAot = IsAotMethod ( ) || IsNetNative ;
53+ public static readonly bool IsAot = IsAotMethod ( ) || FrameworkDescription . StartsWith ( ".NET Native" , StringComparison . OrdinalIgnoreCase ) ;
5654
5755 private static bool IsAotMethod ( )
5856 {
@@ -166,34 +164,15 @@ private static string GetNetCoreVersion()
166164 {
167165 return $ ".NET { Environment . Version } ";
168166 }
169- else
170- {
171- string coreclrLocation = typeof ( object ) . GetTypeInfo ( ) . Assembly . Location ;
172- string corefxLocation = typeof ( Regex ) . GetTypeInfo ( ) . Assembly . Location ;
173-
174- // Handle cases where assembly location is empty (e.g. single-file publish, AOT, some test runners)
175- if ( string . IsNullOrEmpty ( coreclrLocation ) || string . IsNullOrEmpty ( corefxLocation ) )
176- {
177- return CoreRuntime . TryGetVersion ( out var ver ) && ver . Major >= 5
178- ? $ ".NET { ver } (assembly location unavailable)"
179- : $ ".NET Core { ver ? . ToString ( ) ?? Unknown } (assembly location unavailable)";
180- }
181-
182- var coreclrAssemblyInfo = FileVersionInfo . GetVersionInfo ( coreclrLocation ) ;
183- var corefxAssemblyInfo = FileVersionInfo . GetVersionInfo ( corefxLocation ) ;
184167
185- if ( CoreRuntime . TryGetVersion ( out var version ) && version . Major >= 5 )
186- {
187- // after the merge of dotnet/corefx and dotnet/coreclr into dotnet/runtime the version should always be the same
188- Debug . Assert ( coreclrAssemblyInfo . FileVersion == corefxAssemblyInfo . FileVersion ) ;
189-
190- return $ ".NET { version } ({ coreclrAssemblyInfo . FileVersion } )";
191- }
192- else
193- {
194- return $ ".NET Core { version ? . ToString ( ) ?? Unknown } (CoreCLR { coreclrAssemblyInfo . FileVersion } , CoreFX { corefxAssemblyInfo . FileVersion } )";
195- }
196- }
168+ string coreclrLocation = typeof ( object ) . GetTypeInfo ( ) . Assembly . Location ;
169+ // Handle cases where assembly location is empty (e.g. single-file publish, AOT, some test runners)
170+ string fileVersion = string . IsNullOrEmpty ( coreclrLocation )
171+ ? "assembly location unavailable"
172+ : FileVersionInfo . GetVersionInfo ( coreclrLocation ) . FileVersion ;
173+ return CoreRuntime . TryGetVersion ( out var version ) && version . Major >= 5
174+ ? $ ".NET { version } ({ fileVersion } )"
175+ : $ ".NET Core { version ? . ToString ( ) ?? Unknown } ({ fileVersion } )";
197176 }
198177
199178 internal static Runtime GetCurrentRuntime ( )
@@ -275,7 +254,7 @@ internal static string GetJitInfo()
275254 {
276255 if ( IsNativeAOT )
277256 return "NativeAOT" ;
278- if ( IsNetNative || IsAot )
257+ if ( IsAot )
279258 return "AOT" ;
280259 if ( IsMono || IsWasm )
281260 return "" ; // There is no helpful information about JIT on Mono
0 commit comments