dotnet/BenchmarkDotNet · error · InvalidOperationException

Method 'GetRunnerPath' not found.

Error message

Method 'GetRunnerPath' not found.

What it means

GetRunnerPath located the DotTrace ConsoleRunnerPackage instance but its runtime type exposes no 'GetRunnerPath' method. The SelfApi package type was refactored so the method was renamed, re-signatured, or moved off this type.

Source

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

    protected override string CreateSnapshotFilePath(DiagnoserActionParameters parameters)
    {
        return ArtifactFileNameHelper.GetFilePath(parameters, "snapshots", DateTime.Now, "dtp", ".0000".Length);
    }

    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:

View on GitHub (pinned to b515068b61)

Solutions

  1. Restore the JetBrains.Profiler.SelfApi version declared by your BenchmarkDotNet build.
  2. Clear the prerequisite cache and let InitAsync re-download the matching package.
  3. Upgrade BenchmarkDotNet to a release compatible with your SelfApi layout.
Defensive patterns

Strategy: fallback

Try / catch

try { /* use dotTrace diagnoser */ }
catch (InvalidOperationException ex) when (ex.Message.Contains("Method 'GetRunnerPath' not found"))
{
    log.Error("dotTrace SelfApi method renamed/moved; align SelfApi version with BDN.");
}

Prevention

When it happens

Trigger: A JetBrains.Profiler.SelfApi version where the runner-package type no longer has a parameterless GetRunnerPath() method. One reflection step past the missing-field case.

Common situations: SelfApi upgraded out of sync with BDN; cached prerequisite from a different build; insider profiler build.

Related errors


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