dotnet/BenchmarkDotNet · critical · NotSupportedException
Unknown .NET Runtime
Error message
Unknown .NET Runtime
What it means
Thrown by RuntimeInformation.GetCurrentRuntime() when none of the known runtime detectors match: IsWasm, IsNewMono, IsOldMono, IsFullFramework, IsNetCore, and IsNativeAOT all return false. This means BenchmarkDotNet cannot identify the executing .NET runtime and therefore cannot select appropriate host execution strategies, CoreRT/Mono/AOT runtimes, or framework characteristics.
Source
Thrown at src/BenchmarkDotNet/Portability/RuntimeInformation.cs:208
internal static Runtime GetCurrentRuntime()
{
//do not change the order of conditions because it may cause incorrect determination of runtime
if (IsAot && IsMono)
return MonoAotLLVMRuntime.Default;
if (IsWasm)
return WasmRuntime.Default;
if (IsNewMono)
return MonoRuntime.GetCurrentVersion();
if (IsOldMono)
return MonoRuntime.Default;
if (IsFullFramework)
return ClrRuntime.GetCurrentVersion();
if (IsNetCore)
return CoreRuntime.GetCurrentVersion();
if (IsNativeAOT)
return NativeAotRuntime.GetCurrentVersion();
throw new NotSupportedException("Unknown .NET Runtime");
}
public static Platform GetCurrentPlatform()
{
// these are not part of .NET Standard 2.0, so we use hardcoded values taken from
// https://github.com/dotnet/runtime/blob/080fcae7eaa8367abf7900e08ff2e52e3efea5bf/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Architecture.cs#L9
const Architecture Wasm = (Architecture)4;
const Architecture S390x = (Architecture)5;
const Architecture LoongArch64 = (Architecture)6;
const Architecture Armv6 = (Architecture)7;
const Architecture Ppc64le = (Architecture)8;
const Architecture RiscV64 = (Architecture)9;
switch (ProcessArchitecture)
{
case Architecture.Arm:
return Platform.Arm;
case Architecture.Arm64:View on GitHub (pinned to b515068b61)
Solutions
- Upgrade BenchmarkDotNet to a version that supports the target runtime.
- If running on a known runtime that is misdetected, check environment variables and runtime information the detectors rely on.
- For unsupported runtimes, consider explicitly specifying the runtime in the Job configuration rather than relying on auto-detection.
- Report the issue to BenchmarkDotNet with details of the runtime and OS for a detector update.
Example fix
// before (auto-detection fails)
var config = ManualConfig.Create(DefaultConfig.Instance);
// after (explicitly specify runtime)
var config = ManualConfig.Create(DefaultConfig.Instance)
.AddJob(Job.Default.WithRuntime(CoreRuntime.Core80)); Defensive patterns
Strategy: fallback
Try / catch
try
{
var runtime = RuntimeInformation.GetCurrentRuntime();
}
catch (NotSupportedException)
{
// Fallback: explicitly specify the runtime in the Job config
var job = Job.Default.WithRuntime(CoreRuntime.Core80);
} Prevention
- Keep BenchmarkDotNet updated to the latest version that supports your runtime.
- When targeting a new/preview runtime, explicitly configure the runtime in the Job rather than relying on auto-detection.
- Test benchmark suites on the target runtime in CI before relying on them.
When it happens
Trigger: Running BenchmarkDotNet on an unsupported or unrecognized runtime environment, such as a preview/new runtime flavor whose detection heuristics (registry keys, environment variables, type presence checks) are not yet implemented, or on a stripped/self-contained runtime where the detection markers are absent.
Common situations: Using a very new .NET preview or a non-standard runtime (e.g., a custom NativeAOT variant, WASM without the expected detector, or an exotic platform). Also on runtimes where BenchmarkDotNet's version predates the runtime's release.
Related errors
- LargeAddressAware is a Windows-specific concept.
- Benchmark {benchmark.Name} has invalid type of arguments pro
- Inconsistent versions: '{assemblyVersion}' and '{fullVersion
AI-assisted analysis of dotnet/BenchmarkDotNet@b515068b61 (2026-08-13).
Data as JSON: /api/errors/70f90fc36a14eaaa.
Report an issue: GitHub.