dotnet/BenchmarkDotNet · error · NotSupportedException

Please use job.Env.Jit to specify Jit in explicit way

Error message

Please use job.Env.Jit to specify Jit in explicit way

What it means

MonoArgument's constructor rejects "--llvm" and "--nollvm" with NotSupportedException because JIT selection for Mono must go through the first-class job configuration (job.Env.Jit), not a raw CLI flag. Passing the flag directly would bypass and conflict with the structured JIT setting.

Source

Thrown at src/BenchmarkDotNet/Jobs/Argument.cs:39

            if (ReferenceEquals(this, other)) return true;
            return TextRepresentation == other.TextRepresentation;
        }

        public override bool Equals(object? obj) => Equals(obj as Argument);

        public override int GetHashCode() => HashCode.Combine(TextRepresentation);
    }

    /// <summary>
    /// Argument passed directly to mono when executing benchmarks (mono [options])
    /// example: new MonoArgument("--gc=sgen")
    /// </summary>
    public class MonoArgument : Argument
    {
        public MonoArgument(string value) : base(value)
        {
            if (value == "--llvm" || value == "--nollvm")
                throw new NotSupportedException("Please use job.Env.Jit to specify Jit in explicit way");
        }
    }

    /// <summary>
    /// Argument passed to dotnet cli when restoring and building the project
    /// example: new MsBuildArgument("/p:MyCustomSetting=123")
    /// </summary>
    [PublicAPI]
    public class MsBuildArgument : Argument
    {
        private readonly string? displayValue;

        public MsBuildArgument(string value) : base(value) { }

        public MsBuildArgument(string value, bool escapeSpecialCharacters) : base(escapeSpecialCharacters ? EscapeSpecialCharacters(value) : value)
        {
            if (escapeSpecialCharacters)
                displayValue = value;

View on GitHub (pinned to b515068b61)

Solutions

  1. Remove the --llvm/--nollvm MonoArgument from the job.
  2. Set the JIT explicitly via the job environment, e.g. job.WithJit(Jit.Llvm) or job.Env.Jit = Jit.Llvm.
  3. Keep other valid mono arguments (e.g. --gc=sgen) but route JIT choice through Env.Jit.

Example fix

// before
job = job.WithArgument(new MonoArgument("--llvm"));

// after
job = job.WithJit(Jit.Llvm);
Defensive patterns

Strategy: validation

Validate before calling

// do not pass --llvm/--nollvm to MonoArgument; set Jit instead
job = job.WithJit(Jit.Llvm);

Prevention

When it happens

Trigger: Constructing new MonoArgument("--llvm") or new MonoArgument("--nollvm") and attaching it to a Mono job.

Common situations: Porting old mono command-line invocations or scripts that used --llvm/--nollvm into BenchmarkDotNet job configuration instead of the Jit property.

Related errors


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