@@ -25,7 +25,7 @@ internal static class RuntimeInformation
25
25
internal const string ReleaseConfigurationName = "RELEASE" ;
26
26
internal const string Unknown = "?" ;
27
27
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!
29
29
30
30
public static bool IsFullFramework =>
31
31
#if NET6_0_OR_GREATER
@@ -184,6 +184,10 @@ internal static string GetRuntimeVersion()
184
184
185
185
return "Mono " + version ;
186
186
}
187
+ else
188
+ {
189
+ return $ "{ GetNetCoreVersion ( ) } using MonoVM";
190
+ }
187
191
}
188
192
else if ( IsFullFramework )
189
193
{
@@ -208,22 +212,7 @@ internal static string GetRuntimeVersion()
208
212
}
209
213
else if ( IsNetCore )
210
214
{
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 ( ) ;
227
216
}
228
217
else if ( IsNativeAOT )
229
218
{
@@ -233,6 +222,26 @@ internal static string GetRuntimeVersion()
233
222
return Unknown ;
234
223
}
235
224
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
+
236
245
internal static Runtime GetCurrentRuntime ( )
237
246
{
238
247
//do not change the order of conditions because it may cause incorrect determination of runtime
0 commit comments