dotnet/BenchmarkDotNet · error · NotImplementedException

GetRuntimeVersion not implemented for {runtimeMoniker}

Error message

GetRuntimeVersion not implemented for {runtimeMoniker}

What it means

GetRuntimeVersion is a switch expression mapping each RuntimeMoniker to a System.Version; the discard arm (_) throws NotImplementedException for unhandled values. Unlike [65] (ArgumentOutOfRangeException), this signals an incomplete implementation for a recognized-but-unmapped moniker, almost always a library version gap.

Source

Thrown at src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs:134

            RuntimeMoniker.Mono90 => new Version(9, 0),
            RuntimeMoniker.Mono10_0 => new Version(10, 0),
            RuntimeMoniker.Mono11_0 => new Version(11, 0),
            RuntimeMoniker.WasmNet80 => new Version(8, 0),
            RuntimeMoniker.WasmNet90 => new Version(9, 0),
            RuntimeMoniker.WasmNet10_0 => new Version(10, 0),
            RuntimeMoniker.WasmNet11_0 => new Version(11, 0),
            RuntimeMoniker.MonoAOTLLVM => Portability.RuntimeInformation.IsNetCore && CoreRuntime.TryGetVersion(out var version) ? version : new Version(6, 0),
            RuntimeMoniker.MonoAOTLLVMNet60 => new Version(6, 0),
            RuntimeMoniker.MonoAOTLLVMNet70 => new Version(7, 0),
            RuntimeMoniker.MonoAOTLLVMNet80 => new Version(8, 0),
            RuntimeMoniker.MonoAOTLLVMNet90 => new Version(9, 0),
            RuntimeMoniker.MonoAOTLLVMNet10_0 => new Version(10, 0),
            RuntimeMoniker.MonoAOTLLVMNet11_0 => new Version(11, 0),
            RuntimeMoniker.R2R80 => new Version(8, 0),
            RuntimeMoniker.R2R90 => new Version(9, 0),
            RuntimeMoniker.R2R10_0 => new Version(10, 0),
            RuntimeMoniker.R2R11_0 => new Version(11, 0),
            _ => throw new NotImplementedException($"{nameof(GetRuntimeVersion)} not implemented for {runtimeMoniker}")
        };
    }
}

View on GitHub (pinned to b515068b61)

Solutions

  1. Update BenchmarkDotNet to the release that adds the mapping for your moniker.
  2. Fall back to a supported moniker of equivalent version.
  3. Confirm the moniker is in both GetRuntime and GetRuntimeVersion cases for your installed version.

Example fix

// before
RuntimeMoniker.Net11_0 // not yet mapped in installed version

// after
RuntimeMoniker.Net10_0 // supported by installed version
Defensive patterns

Strategy: validation

Validate before calling

// ensure the installed BenchmarkDotNet version maps your moniker in GetRuntimeVersion
// fall back to a known-supported moniker if not

Prevention

When it happens

Trigger: A RuntimeMoniker enum value reaches the default arm of GetRuntimeVersion, i.e. one present in the enum but not yet cased (common with brand-new or preview monikers in an older library version).

Common situations: New .NET release moniker used with an older BenchmarkDotNet, a custom/forked RuntimeMoniker enum, or relying on a moniker added after the version you reference.

Related errors


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