{"record":{"id":"04d5210b7712521e","repo":"dotnet/BenchmarkDotNet","slug":"unable-to-get-value-of-consolerunnerpackage-04d521","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.dotTrace/DotTraceDiagnoser.cs","lineNumber":59,"sourceCode":"    protected override void Detach()\n    {\n        DotTrace.Detach();\n    }\n\n    protected override string CreateSnapshotFilePath(DiagnoserActionParameters parameters)\n    {\n        return ArtifactFileNameHelper.GetFilePath(parameters, \"snapshots\", DateTime.Now, \"dtp\", \".0000\".Length);\n    }\n\n    protected override string GetRunnerPath()\n    {\n        var consoleRunnerPackageField = typeof(DotTrace).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":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet.Diagnostics.dotTrace/DotTraceDiagnoser.cs#L41-L77","documentation":"GetRunnerPath found the 'ConsoleRunnerPackage' field on DotTrace but its value is null. The field exists; DotTrace.InitAsync has not populated the package instance (or populated then nulled it).","triggerScenarios":"InitTool (DotTrace.InitAsync) returned without throwing but never assigned the static package instance, or assigned and reset it. Same shape as the dotMemory null-field case.","commonSituations":"InitAsync completed against a corrupted/partial prerequisite; GetRunnerPath invoked out of order with Init; SelfApi build that lazily instantiates the package.","solutions":["Let InitTool run to completion before GetRunnerPath (SnapshotProfilerBase.Init already does this).","Clear the dotTrace prerequisite cache and re-run InitAsync.","Match the SelfApi version to your BDN build."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* use dotTrace diagnoser */ }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Unable to get value of 'ConsoleRunnerPackage'\"))\n{\n    log.Error(\"dotTrace prerequisite not initialized; clear cache and let InitAsync re-download.\");\n}","preventionTips":["Let InitTool run fully before GetRunnerPath is called.","Clear the cached prerequisite after an interrupted init.","Keep the SelfApi version aligned with the BDN build."],"tags":["benchmarkdotnet","dottrace","jetbrains","reflection","profiler","init"],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}