Process.RedirectStandardOutput not working

I have a problem redirecting the application's standard output. It seems to be some kind of bug in .NET.

I run Live555ProxyServer , but I don't get any output even when the console that launches has written output. This code works with any other console application, but not this one.

void StartProcess()
    var process = new Process();
    process.StartInfo.FileName = @"live555ProxyServer.exe";
    process.StartInfo.Arguments = "-R";
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardOutput = true;
    process.OutputDataReceived += process_OutputDataReceived;


void process_OutputDataReceived(object sender, DataReceivedEventArgs e)


The source code for this application can be found here


source to share

1 answer

This is because all the output goes stderr

instead stdout

, see source code

You have to add a handler for Process.ErrorDataReceived

and call Process.BeginErrorReadLine

and everything will start smoothly.



All Articles