dotnet/BenchmarkDotNet · error · InvalidOperationException
Unable to invoke 'GetRunnerPath'.
Error message
Unable to invoke 'GetRunnerPath'.
What it means
GetRunnerPath's final guard: GetRunnerPath was found and invoked but returned null (or could not be cast to string). The method exists but did not yield a usable runner path, typically because the prerequisite package never fully extracted its runner binary.
Source
Thrown at src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs:65
protected override string GetRunnerPath()
{
var consoleRunnerPackageField = typeof(DotMemory).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)
Solutions
- Clear the cached prerequisite directory and re-run so InitAsync re-downloads and extracts cleanly.
- Check disk space and write permissions for the cache directory.
- Disable/reconfigure antivirus that may quarantine the JetBrains runner executable.
- Match the SelfApi version to your BenchmarkDotNet build.
Defensive patterns
Strategy: fallback
Try / catch
try { /* use dotMemory diagnoser */ }
catch (InvalidOperationException ex) when (ex.Message.Contains("Unable to invoke 'GetRunnerPath'"))
{
log.Error("dotMemory runner not extracted; check disk/AV/cache and re-run InitAsync.");
} Prevention
- Clear the prerequisite cache so InitAsync re-extracts the runner cleanly.
- Ensure disk space and write permissions for the cache directory.
- Check antivirus quarantine rules for the JetBrains runner exe.
When it happens
Trigger: InitAsync downloaded the prerequisite but the runner executable was not extracted / not placed where GetRunnerPath expects, so the method returns null. Can also occur if invocation itself throws and the SelfApi catches and returns null internally.
Common situations: Corrupted or interrupted prerequisite download/extraction; antivirus quarantining the runner exe; insufficient disk space or permissions to write the runner; partial state left from a previously failed run.
Related errors
- Unable to get value of 'ConsoleRunnerPackage'.
- Field 'ConsoleRunnerPackage' not found.
- Method 'GetRunnerPath' not found.
- Unable to get value of 'ConsoleRunnerPackage'.
- Unable to invoke 'GetRunnerPath'.
AI-assisted analysis of dotnet/BenchmarkDotNet@b515068b61 (2026-08-13).
Data as JSON: /api/errors/09137ba81828cba9.
Report an issue: GitHub.