dotnet/reactive · error · InvalidOperationException

Did not get output from program

Error message

Did not get output from program

What it means

ModifiedProjectClone.RunDotnetCommonBuild (used by RunDotnetBuild/RunDotnetPack/RunDotnetPublish) launches dotnet and polls the stdout task with Task.WhenAny + Task.Delay(2000). If stdout never completes, it throws InvalidOperationException('Did not get output from program'), aborting the build/pack/publish of the cloned project.

Solutions

  1. Run the same dotnet command manually in the clone folder to see why it hangs
  2. Check NuGet feed connectivity / disable first-run experience (DOTNET_SKIP_FIRST_TIME_EXPERIENCE, --no-restore) if restore is the bottleneck
  3. Increase the polling timeout for large builds
  4. Ensure both stdout and stderr are drained concurrently to avoid pipe-buffer deadlock
Defensive patterns

Strategy: try-catch

Validate before calling

var psi = new ProcessStartInfo("dotnet", args) { RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false };
using var p = Process.Start(psi);
if (p is null) throw new InvalidOperationException("dotnet failed to start");

Type guard

bool OutputCompleted(Task<string> t, int ms) => Task.WaitAny(new[]{t}, ms) != -1;

Try / catch

try
{
    var output = await clone.RunDotnetBuildAsync(...);
}
catch (InvalidOperationException ex) when (ex.Message == "Did not get output from program")
{
    // kill dotnet/msbuild nodes, check feed connectivity, retry with longer timeout
}

Prevention

When it happens

Trigger: The spawned dotnet process hangs or produces no terminating stdout while the polling loop waits, leaving stdOutTask incomplete at the final check.

Common situations: dotnet restore hanging on a network feed; first-run SDK telemetry/first-time-experience delay; the clone folder lacks a valid project so dotnet waits or fails oddly; pipe not closed due to a spawned MSBuild node lingering.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15). Data as JSON: /api/errors/0066b3622a8b4f00. Report an issue: GitHub.

Appendix: source

Thrown at Rx.NET/Test/Gauntlet/RxGauntlet.Common/Build/ModifiedProjectClone.cs:148

            WorkingDirectory = _copyPath,
        };

        using var process = new Process { StartInfo = startInfo };
        process.Start();
        Task<string> stdOutTask = Task.Run(process.StandardOutput.ReadToEndAsync);
        Task processTask = process.WaitForExitAsync();
        Task firstToFinish = await Task.WhenAny(processTask, stdOutTask);

        if (!stdOutTask.IsCompleted)
        {
            // The process finished, but the standard output task is still running. It's possible that
            // it is nearly done, so give it some time.
            await Task.WhenAny(stdOutTask, Task.Delay(2000));
        }

        if (!stdOutTask.IsCompleted)
        {
            throw new InvalidOperationException("Did not get output from program");
        }
        string stdOut = await stdOutTask;

        await processTask;
        string outputFolder = Path.Combine(ClonedProjectFolderPath, "bin", "Release");
        return new BuildOutput(process.ExitCode, outputFolder, stdOut);
    }
}

View on GitHub (pinned to 94b5d5ab91)