Why is my process's Exited method not being called?
In order to receive a callback on Exited
event, the EnableRaisingEvents
must be set to true.
Process correctionProcess = Process.Start(startInfo);
correctionProcess.EnableRaisingEvents = true;
correctionProcess.Exited += new EventHandler(ProcessExited);
From MSDN:
The Exited event indicates that the associated process exited. This occurrence means either that the process terminated (aborted) or successfully closed. This event can occur only if the value of the EnableRaisingEvents property is true.
Have you set that property to true?
You must set Process.EnableRaisingEvents
to true
.