dotnet/BenchmarkDotNet · error · ArgumentOutOfRangeException
Runtime Moniker not supported
Error message
Runtime Moniker not supported
What it means
RuntimeMonikerExtensions.GetRuntime maps each RuntimeMoniker enum value to a runtime instance via a switch; the default arm throws ArgumentOutOfRangeException ("Runtime Moniker not supported"). This fires when a moniker value has no mapping, typically a newly added enum member the loaded library version does not recognize.
Source
Thrown at src/BenchmarkDotNet/Extensions/RuntimeMonikerExtensions.cs:83
return MonoRuntime.Mono70;
case RuntimeMoniker.Mono80:
return MonoRuntime.Mono80;
case RuntimeMoniker.Mono90:
return MonoRuntime.Mono90;
case RuntimeMoniker.Mono10_0:
return MonoRuntime.Mono10_0;
case RuntimeMoniker.Mono11_0:
return MonoRuntime.Mono11_0;
case RuntimeMoniker.R2R80:
return R2RRuntime.Net80;
case RuntimeMoniker.R2R90:
return R2RRuntime.Net90;
case RuntimeMoniker.R2R10_0:
return R2RRuntime.Net10_0;
case RuntimeMoniker.R2R11_0:
return R2RRuntime.Net11_0;
default:
throw new ArgumentOutOfRangeException(nameof(runtimeMoniker), runtimeMoniker, "Runtime Moniker not supported");
}
}
internal static Version GetRuntimeVersion(this RuntimeMoniker runtimeMoniker) => runtimeMoniker switch
{
RuntimeMoniker.Net461 => new Version(4, 6, 1),
RuntimeMoniker.Net462 => new Version(4, 6, 2),
RuntimeMoniker.Net47 => new Version(4, 7),
RuntimeMoniker.Net471 => new Version(4, 7, 1),
RuntimeMoniker.Net472 => new Version(4, 7, 2),
RuntimeMoniker.Net48 => new Version(4, 8),
RuntimeMoniker.Net481 => new Version(4, 8, 1),
RuntimeMoniker.NetCoreApp20 => new Version(2, 0),
RuntimeMoniker.NetCoreApp21 => new Version(2, 1),
RuntimeMoniker.NetCoreApp22 => new Version(2, 2),
RuntimeMoniker.NetCoreApp30 => new Version(3, 0),
RuntimeMoniker.NetCoreApp31 => new Version(3, 1),
RuntimeMoniker.Net50 => new Version(5, 0),View on GitHub (pinned to b515068b61)
Solutions
- Upgrade BenchmarkDotNet to a version that supports the RuntimeMoniker you are using.
- Use a moniker known to be supported by your installed version (e.g. Net90 instead of a newer one).
- Verify the enum value is within the supported set before configuring the job.
Example fix
// before (on an older BenchmarkDotNet build) job = Job.Default.WithRuntime(CoreRuntime.Net100); // moniker unsupported // after job = Job.Default.WithRuntime(CoreRuntime.Net90);
Defensive patterns
Strategy: validation
Validate before calling
if (!Enum.IsDefined(typeof(RuntimeMoniker), moniker)) throw new ArgumentOutOfRangeException(nameof(moniker)); // and pin a BenchmarkDotNet version that maps the moniker you use
Prevention
- Keep BenchmarkDotNet version aligned with the newest runtime you target.
- Prefer WithRuntime(CoreRuntime.NetXX) over raw RuntimeMoniker where possible.
- Check release notes for newly added monikers before adopting them.
When it happens
Trigger: Passing a RuntimeMoniker value not covered by the GetRuntime switch (e.g. a moniker introduced in a newer BenchmarkDotNet release while an older version is loaded, or a future/undefined enum value).
Common situations: Version mismatch between the RuntimeMoniker enum the code was compiled against and the installed BenchmarkDotNet, using a preview moniker in a stable build, or casting an invalid integer to RuntimeMoniker.
Related errors
- String cannot be empty.
- GetRuntimeVersion not implemented for {runtimeMoniker}
- Please use job.Env.Jit to specify Jit in explicit way
- Property name must be non-empty.
- Runtime moniker {runtimeMoniker} is not supported
AI-assisted analysis of dotnet/BenchmarkDotNet@b515068b61 (2026-08-13).
Data as JSON: /api/errors/5a38c6ece1127bf8.
Report an issue: GitHub.