行の try-catch にブレークポイントを配置しましたusing
。もう1つはresult.wasSuccessful
ラインにあります。
これを行うcatch
と、エラーが返されると表示されます。
ただし、using
行にブレークポイントがない場合、エラーはキャッチされません。
なぜこうなった?
ここにエラーがあります
+ $exception {"Cannot process request because the process (12400) has exited."} System.Exception {System.InvalidOperationException}
try
{
using (Process exeProcess = Process.Start(psi))
{
exeProcess.PriorityClass = ProcessPriorityClass.High;
var outString = new StringBuilder(100);
exeProcess.OutputDataReceived += (s, e) => outString.AppendLine(e.Data);
exeProcess.BeginOutputReadLine();
var errString = exeProcess.StandardError.ReadToEnd();
if (!string.IsNullOrEmpty(errString))
{
result.WasSuccessful = false;
result.ErrorMessage = errString;
}
}
}
catch (Exception ex)
{
result.WasSuccessful = false;
result.ErrorMessage = ex.ToString();
}