dotnet/BenchmarkDotNet · error · InvalidOperationException

Unable to invoke 'GetRunnerPath'.

Error message

Unable to invoke 'GetRunnerPath'.

What it means

GetRunnerPath's final guard for dotTrace: GetRunnerPath was found and invoked but returned null / not castable to string. The method exists but produced no usable runner path, usually because the prerequisite runner binary was never extracted.

Solutions

  1. Delete the cached prerequisite directory and re-run InitAsync to re-download and extract cleanly.
  2. Verify disk space and write permissions for the cache path.
  3. Check/reconfigure antivirus that may quarantine the JetBrains runner.
  4. Align the SelfApi version with your BDN build.
Defensive patterns

Strategy: fallback

Try / catch

try { /* use dotTrace diagnoser */ }
catch (InvalidOperationException ex) when (ex.Message.Contains("Unable to invoke 'GetRunnerPath'"))
{
    log.Error("dotTrace runner not extracted; check disk/AV/cache and re-run InitAsync.");
}

Prevention

When it happens

Trigger: InitAsync downloaded the prerequisite but the runner executable was not extracted to the expected location, so GetRunnerPath returns null; or the invocation failed internally and SelfApi swallowed it into a null return.

Common situations: Corrupted/interrupted prerequisite download or extraction; antivirus quarantining the runner exe; insufficient disk space/permissions; leftover partial state from a prior failed run.

Related errors


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

Appendix: source

Thrown at src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs:68

    protected override string GetRunnerPath()
    {
        var consoleRunnerPackageField = typeof(DotTrace).GetField("ConsoleRunnerPackage", BindingFlags.NonPublic | BindingFlags.Static);
        if (consoleRunnerPackageField == null)
            throw new InvalidOperationException("Field 'ConsoleRunnerPackage' not found.");

        object? consoleRunnerPackage = consoleRunnerPackageField.GetValue(null);
        if (consoleRunnerPackage == null)
            throw new InvalidOperationException("Unable to get value of 'ConsoleRunnerPackage'.");

        var consoleRunnerPackageType = consoleRunnerPackage.GetType();
        var getRunnerPathMethod = consoleRunnerPackageType.GetMethod("GetRunnerPath");
        if (getRunnerPathMethod == null)
            throw new InvalidOperationException("Method 'GetRunnerPath' not found.");

        string? runnerPath = getRunnerPathMethod.Invoke(consoleRunnerPackage, null) as string;
        if (runnerPath == null)
            throw new InvalidOperationException("Unable to invoke 'GetRunnerPath'.");

        return runnerPath;
    }

    internal override bool IsSupported(RuntimeMoniker runtimeMoniker)
    {
        switch (runtimeMoniker)
        {
            case RuntimeMoniker.HostProcess:
            case RuntimeMoniker.Net461:
            case RuntimeMoniker.Net462:
            case RuntimeMoniker.Net47:
            case RuntimeMoniker.Net471:
            case RuntimeMoniker.Net472:
            case RuntimeMoniker.Net48:
            case RuntimeMoniker.Net481:
            case RuntimeMoniker.Net50:
            case RuntimeMoniker.Net60:

View on GitHub (pinned to b515068b61)