dotnet/BenchmarkDotNet · error · NotSupportedException

Runtime {runtimeId} is not supported

Error message

Runtime {runtimeId} is not supported

What it means

While parsing the `--runtimes` CLI option, ConfigParser switches over a RuntimeMoniker to build the appropriate Job (Core/Mono/NetFramework/NativeAOT/ReadyToRun). The default arm throws NotSupportedException for any moniker the installed BenchmarkDotNet version does not know how to materialize. runtimeId in the message is the moniker name from the command line.

Source

Thrown at src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs:700

                    return MakeMonoJob(baseJob, options, MonoRuntime.Mono80);

                case RuntimeMoniker.Mono90:
                    return MakeMonoJob(baseJob, options, MonoRuntime.Mono90);

                case RuntimeMoniker.Mono10_0:
                    return MakeMonoJob(baseJob, options, MonoRuntime.Mono10_0);

                case RuntimeMoniker.Mono11_0:
                    return MakeMonoJob(baseJob, options, MonoRuntime.Mono11_0);

                case RuntimeMoniker.R2R80:
                case RuntimeMoniker.R2R90:
                case RuntimeMoniker.R2R10_0:
                case RuntimeMoniker.R2R11_0:
                    return CreateR2RJob(baseJob, options, runtimeMoniker.GetRuntime());

                default:
                    throw new NotSupportedException($"Runtime {runtimeId} is not supported");
            }
        }

        private static Job CreateAotJob(Job baseJob, CommandLineOptions options, RuntimeMoniker runtimeMoniker, string ilCompilerVersion, string nuGetFeedUrl = "")
        {
            var builder = NativeAotToolchain.CreateBuilder();

            if (options.CliPath != null)
                builder.DotNetCli(options.CliPath.FullName);
            if (options.RestorePath != null)
                builder.PackagesRestorePath(options.RestorePath.FullName);

            if (options.IlcPackages != null)
                builder.UseLocalBuild(options.IlcPackages);
            else if (options.ILCompilerVersion.IsNotBlank())
                builder.UseNuGet(options.ILCompilerVersion, nuGetFeedUrl);
            else
                builder.UseNuGet(ilCompilerVersion, nuGetFeedUrl);

View on GitHub (pinned to b515068b61)

Solutions

  1. Upgrade BenchmarkDotNet to a release that knows the target runtime moniker.
  2. Use a supported `--runtimes` token matching the installed BDN version (check the enum values and docs).
  3. If you only need the host runtime, omit `--runtimes` (defaults to HostProcess).
  4. For custom runtimes, configure the Job programmatically (Job.Default.WithRuntime(...)) instead of via CLI.

Example fix

# before
dotnet run -c Release --runtimes net10.0   # moniker not handled by this BDN

# after
dotnet run -c Release --runtimes net9.0    # supported by current BDN
# or upgrade the BenchmarkDotNet package reference
Defensive patterns

Strategy: validation

Validate before calling

if (!Enum.TryParse<RuntimeMoniker>(monikerName, ignoreCase: true, out var moniker)
    || !IsHandledMoniker(moniker))
    throw new ArgumentException($"Runtime '{monikerName}' is not supported by this BenchmarkDotNet version.");
// then pass it to the runner

Type guard

static bool IsHandledMoniker(RuntimeMoniker m)
    => m is RuntimeMoniker.NetCoreApp31 or RuntimeMoniker.Net50 or RuntimeMoniker.Net60
       or RuntimeMoniker.Net70 or RuntimeMoniker.Net80 or RuntimeMoniker.Net90
       or RuntimeMoniker.Net48 or RuntimeMoniker.Mono /* ...handled set... */;

Try / catch

try { BenchmarkRunner.Run(benchmarks); }
catch (NotSupportedException ex) when (ex.Message.Contains("Runtime") && ex.Message.Contains("not supported"))
{
    // drop the unsupported moniker from --runtimes or upgrade BenchmarkDotNet
}

Prevention

When it happens

Trigger: Passing a `--runtimes` value that maps to a RuntimeMoniker BDN recognizes as an enum member but has no build branch for, or a value from a newer .NET release than this BDN supports (the moniker exists but isn't handled, or parses to NotRecognized/HostProcess that falls through).

Common situations: Running an older BenchmarkDotNet against a brand-new .NET TFM, a typo in the runtime name that still parses, or a custom RuntimeMoniker extension without a matching ConfigParser case.

Related errors


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