dotnet/BenchmarkDotNet · error · InvalidOperationException
Field 'ConsoleRunnerPackage' not found.
Error message
Field 'ConsoleRunnerPackage' not found.
What it means
DotMemoryDiagnoser.GetRunnerPath reflects into JetBrains.Profiler.SelfApi's DotMemory type to find the private static field 'ConsoleRunnerPackage'. It throws when that field no longer exists, meaning the bundled SelfApi package layout has changed from what this BDN build expects. GetRunnerPath runs from SnapshotProfilerBase.Init right after InitTool (DotMemory.InitAsync) succeeds.
Source
Thrown at src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs:52
{
DotMemory.GetSnapshot();
}
protected override void Detach()
{
DotMemory.Detach();
}
protected override string CreateSnapshotFilePath(DiagnoserActionParameters parameters)
{
return ArtifactFileNameHelper.GetFilePath(parameters, "snapshots", DateTime.Now, "dmw", ".0000".Length);
}
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)View on GitHub (pinned to b515068b61)
Solutions
- Use the JetBrains.Profiler.SelfApi version that ships with / is referenced by your BenchmarkDotNet.Diagnostics.dotMemory build (do not independently upgrade it).
- Clear the cached prerequisite (delete the SelfApi download cache) so InitAsync re-fetches the expected package.
- Upgrade BenchmarkDotNet to a release that matches the SelfApi layout you have installed.
- If patching BDN, update GetRunnerPath to match the current SelfApi field/method names.
Defensive patterns
Strategy: fallback
Try / catch
// Init() already retries InitTool 5x; GetRunnerPath failures surface there. At the call site:
try { diagnoser.Handle(...); }
catch (InvalidOperationException ex) when (ex.Message.Contains("ConsoleRunnerPackage"))
{
log.Error("dotMemory SelfApi layout mismatch - align JetBrains.Profiler.SelfApi version with your BDN build.");
} Prevention
- Do not upgrade JetBrains.Profiler.SelfApi independently of BenchmarkDotNet.
- Clear the prerequisite cache after a BDN upgrade so InitAsync fetches the matching package.
- Pin the SelfApi version declared by the BDN diagnoser package.
When it happens
Trigger: The loaded JetBrains.Profiler.SelfApi assembly (downloaded/updated by InitAsync, or pinned via NuGet) is a version where 'ConsoleRunnerPackage' was renamed, moved, or removed. Happens after a SelfApi package upgrade, a forced NuGet override, or a corrupted/again-downloaded prerequisite.
Common situations: Upgrading the dotMemory SelfApi dependency independent of BenchmarkDotNet; offline/cached prerequisite that is a different build; running against a preview/insider build of the JetBrains profiler.
Related errors
- Method 'GetRunnerPath' not found.
- Unable to get value of 'ConsoleRunnerPackage'.
- Unable to invoke 'GetRunnerPath'.
- Field 'ConsoleRunnerPackage' not found.
- Method 'GetRunnerPath' not found.
AI-assisted analysis of dotnet/BenchmarkDotNet@b515068b61 (2026-08-13).
Data as JSON: /api/errors/5ea21c8aff5d3419.
Report an issue: GitHub.