{"record":{"id":"c9f77f1340f7a948","repo":"dotnet/BenchmarkDotNet","slug":"unable-to-get-value-of-consolerunnerpackage","errorCode":null,"errorMessage":"Unable to get value of 'ConsoleRunnerPackage'.","messagePattern":"Unable to get value of 'ConsoleRunnerPackage'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs","lineNumber":56,"sourceCode":"    protected override void Detach()\n    {\n        DotMemory.Detach();\n    }\n\n    protected override string CreateSnapshotFilePath(DiagnoserActionParameters parameters)\n    {\n        return ArtifactFileNameHelper.GetFilePath(parameters, \"snapshots\", DateTime.Now, \"dmw\", \".0000\".Length);\n    }\n\n    protected override string GetRunnerPath()\n    {\n        var consoleRunnerPackageField = typeof(DotMemory).GetField(\"ConsoleRunnerPackage\", BindingFlags.NonPublic | BindingFlags.Static);\n        if (consoleRunnerPackageField == null)\n            throw new InvalidOperationException(\"Field 'ConsoleRunnerPackage' not found.\");\n\n        object? consoleRunnerPackage = consoleRunnerPackageField.GetValue(null);\n        if (consoleRunnerPackage == null)\n            throw new InvalidOperationException(\"Unable to get value of 'ConsoleRunnerPackage'.\");\n\n        var consoleRunnerPackageType = consoleRunnerPackage.GetType();\n        var getRunnerPathMethod = consoleRunnerPackageType.GetMethod(\"GetRunnerPath\");\n        if (getRunnerPathMethod == null)\n            throw new InvalidOperationException(\"Method 'GetRunnerPath' not found.\");\n\n        string? runnerPath = getRunnerPathMethod.Invoke(consoleRunnerPackage, null) as string;\n        if (runnerPath == null)\n            throw new InvalidOperationException(\"Unable to invoke 'GetRunnerPath'.\");\n\n        return runnerPath;\n    }\n\n    internal override bool IsSupported(RuntimeMoniker runtimeMoniker)\n    {\n        switch (runtimeMoniker)\n        {\n            case RuntimeMoniker.HostProcess:","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs#L38-L74","documentation":"GetRunnerPath found the 'ConsoleRunnerPackage' field but its value is null. The field exists but DotMemory.InitAsync has not populated it (or populated and then reset it). This is the second guard in the reflection chain used to locate the dotMemory runner executable.","triggerScenarios":"InitTool (DotMemory.InitAsync) returned without error but never assigned the static ConsoleRunnerPackage instance; or it was assigned and later nulled (e.g. partial/failed prerequisite install that reported success, or a SelfApi version that lazily populates the field).","commonSituations":"InitAsync succeeded against a corrupted prerequisite download; running Init concurrently or calling GetRunnerPath before Init has fully populated state; a SelfApi build that defers package instantiation.","solutions":["Ensure InitTool completes fully before GetRunnerPath is invoked (SnapshotProfilerBase.Init does this in order).","Clear the cached dotMemory prerequisite and let InitAsync re-download it.","Align the JetBrains.Profiler.SelfApi version with the BenchmarkDotNet build."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* use dotMemory diagnoser */ }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Unable to get value of 'ConsoleRunnerPackage'\"))\n{\n    log.Error(\"dotMemory prerequisite not initialized; clear cache and let InitAsync re-download.\");\n}","preventionTips":["Let InitTool run fully before GetRunnerPath is called.","Clear the cached prerequisite if a previous Init was interrupted.","Keep SelfApi version aligned with the BDN build."],"tags":["benchmarkdotnet","dotmemory","jetbrains","reflection","profiler","init"],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}