Before start let me say that I already tried to use variant which is described there.
Problem is folowing, I have very simple program in C which is just write to output and read input.
#include <stdio.h>
#include <stdint.h>
int main()
{
    int size;
    printf("Enter size: ");
    scanf("%d", &size);
    printf("\n size = %d", size);
    return 0;
}
Second program wrote in C#. This program should start from another process first and obtain input and output. But the program is freezed when try to read input. At first call of Console.Write(process.StandardOutput.ReadLine());
static void Main(string[] args)
{
    try
    {
        var fName = "test.exe";
        var pci = new ProcessStartInfo
        {
            FileName = fName,
            Arguments = "/c DIR",
            UseShellExecute = false,
            RedirectStandardInput = true,
            RedirectStandardOutput = true,
            RedirectStandardError = true,
            CreateNoWindow = true,
        };
        using (var process = Process.Start(pci))
        {
            Console.WriteLine(process.ProcessName);
            Console.Write(process.StandardOutput.ReadLine());
            process.StandardInput.WriteLine("4");
            Console.Write(process.StandardOutput.ReadLine());
            process.WaitForExit(1000);
        }
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
    Console.ReadLine();
}
Does anybody know why it freezed? Or where to take a look?
P.S. with asnyc reading problem the same
