C#: Process.HasExited returns false even though the process has terminated

Posted by Jeremy on Stack Overflow See other posts from Stack Overflow or by Jeremy
Published on 2010-05-06T08:39:48Z Indexed on 2010/05/06 8:48 UTC
Read the original article Hit count: 359

Filed under:
|

Possibly the inverse of this question: http://stackoverflow.com/questions/2519673/

I called Kill() on a process and it seems to have exited. But when I test HasExited, I get false:

myProcess.Kill();

while ( !myProcess.HasExited )
{
    Thread.Sleep(1000);
}

And this continues indefinitely. Granted, I have to change this code to stop waiting eventually, but I'm curious as to why HasExited still returns false when the process seems to have dropped off the map so to speak.

© Stack Overflow or respective owner

Related posts about c#

Related posts about process