@@ -25,7 +25,7 @@ internal static class RuntimeInformation
2525 internal const string ReleaseConfigurationName = "RELEASE" ;
2626 internal const string Unknown = "?" ;
2727
28- public static bool IsMono { get ; } = Type . GetType ( "Mono.Runtime " ) != null ; // it allocates a lot of memory, we need to check it once in order to keep Engine non-allocating!
28+ public static bool IsMono { get ; } = Type . GetType ( "Mono.RuntimeStructs " ) != null ; // it allocates a lot of memory, we need to check it once in order to keep Engine non-allocating!
2929
3030 public static bool IsFullFramework =>
3131#if NET6_0_OR_GREATER
@@ -184,6 +184,10 @@ internal static string GetRuntimeVersion()
184184
185185 return "Mono " + version ;
186186 }
187+ else
188+ {
189+ return $ "{ GetNetCoreVersion ( ) } using MonoVM";
190+ }
187191 }
188192 else if ( IsFullFramework )
189193 {
@@ -208,22 +212,7 @@ internal static string GetRuntimeVersion()
208212 }
209213 else if ( IsNetCore )
210214 {
211- var coreclrAssemblyInfo = FileVersionInfo . GetVersionInfo ( typeof ( object ) . GetTypeInfo ( ) . Assembly . Location ) ;
212- var corefxAssemblyInfo = FileVersionInfo . GetVersionInfo ( typeof ( Regex ) . GetTypeInfo ( ) . Assembly . Location ) ;
213-
214- if ( CoreRuntime . TryGetVersion ( out var version ) && version >= new Version ( 5 , 0 ) )
215- {
216- // after the merge of dotnet/corefx and dotnet/coreclr into dotnet/runtime the version should always be the same
217- Debug . Assert ( coreclrAssemblyInfo . FileVersion == corefxAssemblyInfo . FileVersion ) ;
218-
219- return $ ".NET { version } ({ coreclrAssemblyInfo . FileVersion } )";
220- }
221- else
222- {
223- string runtimeVersion = version != default ? version . ToString ( ) : "?" ;
224-
225- return $ ".NET Core { runtimeVersion } (CoreCLR { coreclrAssemblyInfo . FileVersion } , CoreFX { corefxAssemblyInfo . FileVersion } )";
226- }
215+ return GetNetCoreVersion ( ) ;
227216 }
228217 else if ( IsNativeAOT )
229218 {
@@ -233,6 +222,26 @@ internal static string GetRuntimeVersion()
233222 return Unknown ;
234223 }
235224
225+ private static string GetNetCoreVersion ( )
226+ {
227+ var coreclrAssemblyInfo = FileVersionInfo . GetVersionInfo ( typeof ( object ) . GetTypeInfo ( ) . Assembly . Location ) ;
228+ var corefxAssemblyInfo = FileVersionInfo . GetVersionInfo ( typeof ( Regex ) . GetTypeInfo ( ) . Assembly . Location ) ;
229+
230+ if ( CoreRuntime . TryGetVersion ( out var version ) && version >= new Version ( 5 , 0 ) )
231+ {
232+ // after the merge of dotnet/corefx and dotnet/coreclr into dotnet/runtime the version should always be the same
233+ Debug . Assert ( coreclrAssemblyInfo . FileVersion == corefxAssemblyInfo . FileVersion ) ;
234+
235+ return $ ".NET { version } ({ coreclrAssemblyInfo . FileVersion } )";
236+ }
237+ else
238+ {
239+ string runtimeVersion = version != default ? version . ToString ( ) : "?" ;
240+
241+ return $ ".NET Core { runtimeVersion } (CoreCLR { coreclrAssemblyInfo . FileVersion } , CoreFX { corefxAssemblyInfo . FileVersion } )";
242+ }
243+ }
244+
236245 internal static Runtime GetCurrentRuntime ( )
237246 {
238247 //do not change the order of conditions because it may cause incorrect determination of runtime
0 commit comments