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
- Remove the --llvm/--nollvm MonoArgument from the job.
- Set the JIT explicitly via the job environment, e.g. job.WithJit(Jit.Llvm) or job.Env.Jit = Jit.Llvm.
- 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
- Route Mono JIT choice through job.Env.Jit / WithJit, never raw CLI flags.
- Audit ported mono scripts for --llvm/--nollvm before converting to jobs.
- Keep only GC and other non-JIT mono arguments as MonoArgument.
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
- String cannot be empty.
- Runtime Moniker not supported
- Property name must be non-empty.
- The value {value} is not assignable to {characteristic} prop
- Can't parse threshold '{threshold}'
AI-assisted analysis of dotnet/BenchmarkDotNet@b515068b61 (2026-08-13).
Data as JSON: /api/errors/63a9824228d13714.
Report an issue: GitHub.