diff --git a/src/BenchmarkDotNet/Portability/RuntimeInformation.cs b/src/BenchmarkDotNet/Portability/RuntimeInformation.cs index 6064b24dfa..a7da3808c6 100644 --- a/src/BenchmarkDotNet/Portability/RuntimeInformation.cs +++ b/src/BenchmarkDotNet/Portability/RuntimeInformation.cs @@ -50,7 +50,7 @@ public static bool IsNetCore public static bool IsNativeAOT => Environment.Version.Major >= 5 - && string.IsNullOrEmpty(typeof(object).Assembly.Location) // it's merged to a single .exe and .Location returns null + && !RuntimeFeature.IsDynamicCodeSupported // is false on NativeAOT && !IsWasm; // Wasm also returns "" for assembly locations #if NET6_0_OR_GREATER