dotnet/BenchmarkDotNet · error · ArgumentOutOfRangeException

Runtime moniker {runtimeMoniker} is not supported

Error message

Runtime moniker {runtimeMoniker} is not supported

What it means

DotMemoryDiagnoser.IsSupported exhaustively lists every RuntimeMoniker in its switch and throws ArgumentOutOfRangeException on the default branch. The message is a string template ('$"...{runtimeMoniker}...") that will not interpolate in an Exception.Message unless formatted, but the intent is: the diagnoser encountered a runtime moniker it has not been updated to recognize.

Source

Thrown at src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs:127

            case RuntimeMoniker.MonoAOTLLVMNet90:
            case RuntimeMoniker.MonoAOTLLVMNet10_0:
            case RuntimeMoniker.MonoAOTLLVMNet11_0:
            case RuntimeMoniker.Mono60:
            case RuntimeMoniker.Mono70:
            case RuntimeMoniker.Mono80:
            case RuntimeMoniker.Mono90:
            case RuntimeMoniker.Mono10_0:
            case RuntimeMoniker.Mono11_0:
                return false;
            case RuntimeMoniker.NetCoreApp20:
            case RuntimeMoniker.NetCoreApp21:
            case RuntimeMoniker.NetCoreApp22:
                return OsDetector.IsWindows();
            case RuntimeMoniker.NetCoreApp30:
            case RuntimeMoniker.NetCoreApp31:
                return OsDetector.IsWindows() || OsDetector.IsLinux();
            default:
                throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, $"Runtime moniker {runtimeMoniker} is not supported");
        }
    }
}

View on GitHub (pinned to b515068b61)

Solutions

  1. Upgrade BenchmarkDotNet.Diagnostics.dotMemory to a version whose IsSupported switch covers your target framework moniker.
  2. If forking/patching, add the missing case returning the desired bool.
  3. Downgrade or change the Job's runtime to a supported moniker.
Defensive patterns

Strategy: validation

Validate before calling

// Before assigning a Job runtime, gate on a supported moniker set, or upgrade BDN:
static readonly HashSet<RuntimeMoniker> DotMemorySupported = new()
{ RuntimeMoniker.Net80, RuntimeMoniker.Net90, RuntimeMoniker.Net60 /* ...per IsSupported */ };
if (!DotMemorySupported.Contains(job.Runtime.Moniker))
    throw new NotSupportedException($"dotMemory diagnoser does not support {job.Runtime.Moniker}; upgrade BDN.");

Prevention

When it happens

Trigger: A new .NET version ships a RuntimeMoniker value that this BDN build's IsSupported switch has not enumerated yet; or a custom/derived RuntimeMoniker. The throw is reached only for genuinely unknown values - all currently known monikers return true or false.

Common situations: Running a newer BenchmarkDotNet engine that emits a moniker newer than the dotMemory diagnoser build recognizes; using a preview SDK that maps to a moniker not yet in the switch.

Related errors


AI-assisted analysis of dotnet/BenchmarkDotNet@b515068b61 (2026-08-13). Data as JSON: /api/errors/87d3ef12019ae23f. Report an issue: GitHub.