Program exits with code 0 when an external process I call exits.

I have a exe file that I execute with Process.Start. I then do WaitForExit but my program ends the second that one is done as well. I have code after that to process a results file but it never gets touched. the second the console window closes so does my program.

pStart.Start(); pStart.WaitForExit(); if (File.Exists(@"C:\File")) { using (StreamReader reader = new StreamReader(@"C:\File")) { while (!reader.EndOfStream) { string line = reader.ReadLine(); } } } 

I set a break point on that if statement and it never gets hit. As soon as the console program finishes so does mine. I am calling the above code like so.

await Task.Run(() => CallNet()); 

by QA-guy via /r/csharp

Leave a Reply