{"record":{"id":"aee63018f8bf2c5a","repo":"dotnet/reactive","slug":"did-not-get-output-from-program-aee630","errorCode":null,"errorMessage":"Did not get output from program","messagePattern":"Did not get output from program","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Test/Gauntlet/Checks/TransitiveReferences/CheckTransitiveFrameworkReference/RunTransitiveFrameworkReferenceCheck.cs","lineNumber":282,"sourceCode":"                    var stdOutTask = Task.Run(process.StandardOutput.ReadToEndAsync);\n                    var stdErrTask = Task.Run(process.StandardError.ReadToEndAsync);\n                    var processTask = process.WaitForExitAsync();\n                    var firstToFinish = await Task.WhenAny(processTask, stdOutTask, stdErrTask);\n\n                    if (!stdOutTask.IsCompleted)\n                    {\n                        // The process finished, but the standard output task is still running. It's possible that\n                        // it is nearly done, so give it some time.\n                        await Task.WhenAny(stdOutTask, Task.Delay(2000));\n                    }\n                    if (!stdErrTask.IsCompleted)\n                    {\n                        await Task.WhenAny(stdErrTask, Task.Delay(2000));\n                    }\n\n                    if (!stdOutTask.IsCompleted)\n                    {\n                        throw new InvalidOperationException(\"Did not get output from program\");\n                    }\n\n                    if (!stdErrTask.IsCompleted)\n                    {\n                        throw new InvalidOperationException(\"Did not get error output from program\");\n                    }\n                    runStdOut = await stdOutTask;\n                    runStdErr = await stdErrTask;\n\n                    await processTask;\n                    runExitCode = process.ExitCode;\n                }\n#pragma warning restore IDE0063 // Use simple 'using' statement\n            }\n            else\n            {\n                //Debugger.Break();\n                Console.WriteLine(r.BuildStdOut);","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Test/Gauntlet/Checks/TransitiveReferences/CheckTransitiveFrameworkReference/RunTransitiveFrameworkReferenceCheck.cs#L264-L300","documentation":"While running the test app process, RunScenarioAsync awaits both stdout and stderr tasks, polling with Task.WhenAny + Task.Delay(2000). If stdout never completes it throws InvalidOperationException('Did not get output from program'). The child process produced no terminating stdout within the wait loop, typically because it hung or crashed.","triggerScenarios":"The launched test-app process blocks or exits without closing/flushing stdout, leaving stdOutTask incomplete when the polling loop stops.","commonSituations":"Test app deadlocks (e.g., waiting on console input); process crashes before writing output; the app writes huge output causing pipe backpressure if not drained correctly; machine slowness.","solutions":["Run the test app manually with the same arguments to see why stdout never completes","Check for deadlocks or Console.ReadLine/waiting on stdin in the test app","Ensure both stdout and stderr are read concurrently so pipe buffers do not block the child","Increase the polling timeout if the app is legitimately slow to start"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var psi = new ProcessStartInfo(appExe) { RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false };\nusing var p = Process.Start(psi);\nif (p is null) throw new InvalidOperationException(\"App process failed to start\");","typeGuard":"bool StdOutDone(Task t, int ms) => Task.WaitAny(new[]{t}, ms) != -1;","tryCatchPattern":"try\n{\n    await check.RunScenarioAsync(...);\n}\ncatch (InvalidOperationException ex) when (ex.Message == \"Did not get output from program\")\n{\n    // kill hung process, log, mark scenario failed\n}","preventionTips":["Never let the test app block on stdin","Drain stdout and stderr concurrently to prevent pipe deadlock","Set explicit timeouts with process kill as a fallback","Pre-warm the app (restore/JIT) if first-run latency is high"],"tags":["process","timeout","stdout","test-harness"],"backgroundTag":"request-timeout","analyzedSha":"94b5d5ab912789f5abe9a72138a25bbd716fe59c","analyzedAt":"2026-09-15T02:26:24.759Z","contentChangedAt":"2026-09-15T02:26:24.759Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}