{"record":{"id":"63a9824228d13714","repo":"dotnet/BenchmarkDotNet","slug":"please-use-job-env-jit-to-specify-jit-in-explicit","errorCode":null,"errorMessage":"Please use job.Env.Jit to specify Jit in explicit way","messagePattern":"Please use job\\.Env\\.Jit to specify Jit in explicit way","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet/Jobs/Argument.cs","lineNumber":39,"sourceCode":"            if (ReferenceEquals(this, other)) return true;\n            return TextRepresentation == other.TextRepresentation;\n        }\n\n        public override bool Equals(object? obj) => Equals(obj as Argument);\n\n        public override int GetHashCode() => HashCode.Combine(TextRepresentation);\n    }\n\n    /// <summary>\n    /// Argument passed directly to mono when executing benchmarks (mono [options])\n    /// example: new MonoArgument(\"--gc=sgen\")\n    /// </summary>\n    public class MonoArgument : Argument\n    {\n        public MonoArgument(string value) : base(value)\n        {\n            if (value == \"--llvm\" || value == \"--nollvm\")\n                throw new NotSupportedException(\"Please use job.Env.Jit to specify Jit in explicit way\");\n        }\n    }\n\n    /// <summary>\n    /// Argument passed to dotnet cli when restoring and building the project\n    /// example: new MsBuildArgument(\"/p:MyCustomSetting=123\")\n    /// </summary>\n    [PublicAPI]\n    public class MsBuildArgument : Argument\n    {\n        private readonly string? displayValue;\n\n        public MsBuildArgument(string value) : base(value) { }\n\n        public MsBuildArgument(string value, bool escapeSpecialCharacters) : base(escapeSpecialCharacters ? EscapeSpecialCharacters(value) : value)\n        {\n            if (escapeSpecialCharacters)\n                displayValue = value;","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet/Jobs/Argument.cs#L21-L57","documentation":"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.","triggerScenarios":"Constructing new MonoArgument(\"--llvm\") or new MonoArgument(\"--nollvm\") and attaching it to a Mono job.","commonSituations":"Porting old mono command-line invocations or scripts that used --llvm/--nollvm into BenchmarkDotNet job configuration instead of the Jit property.","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."],"exampleFix":"// before\njob = job.WithArgument(new MonoArgument(\"--llvm\"));\n\n// after\njob = job.WithJit(Jit.Llvm);","handlingStrategy":"validation","validationCode":"// do not pass --llvm/--nollvm to MonoArgument; set Jit instead\njob = job.WithJit(Jit.Llvm);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["mono","jit","config","argument"],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}