|Summary:||Overloaded Process.WaitForExit() method returns false immediately|
|Severity:||normal||CC:||jmroot, kumpera, mono-bugs+mono, mono-bugs+runtime|
|Tags:||Is this bug a regression?:||---|
|Last known good build:|
|Attachments:||Solution file with simple console application demonstrating issue.|
Description cmsano 2014-05-16 15:44:35 UTC
Created attachment 6826 [details] Solution file with simple console application demonstrating issue. This works fine on 3.2.6 on OS X 10.9.3. It stopped working on Mono 3.2.7. Verified that this is still not working on 3.4.0. The issue is simple. The Process.WaitForExit(int) value returns immediately, ignoring the wait value that is passed to it.
Comment 1 Rodrigo Kumpera 2014-05-16 16:31:57 UTC
Hi, This has been fixed in mono master. Now it correctly throws InvalidOperationException instead of returning immediately. The previous behavior was wrong and was fixed in 3.2.7 as you noted.
Comment 2 cmsano 2014-05-16 16:49:45 UTC
Where is the InvalidOperationException the documented behavior?
Comment 3 Rodrigo Kumpera 2014-05-16 18:34:33 UTC
From actually testing the MS implementation.
Comment 4 cmsano 2014-05-16 18:46:03 UTC
I'm confused. The correct implementation is that the method should wait for the specified number of milliseconds. If that amount of time elapses, it should return false. However, what is happening on 3.2.7 is that the method returns false *immediately*. Where does the InvalidOperationException come into the picture?
Comment 5 Rodrigo Kumpera 2014-05-16 18:47:08 UTC
Now the correctly behavior, which is throwing an exception, happens.
Comment 6 jmroot 2014-08-11 21:00:07 UTC
This is not the correct behavior for Process.WaitForExit(int32). The correct behavior is for the Process object to return HasExited=false until the Process either exits or the timeout occurs where timeout is the value in milliseconds passed to WaitForExit. Nowhere in .NET does this throw an InvalidOperationException. This is a regression and this bug should be reactivated and resolved properly. This was working correctly prior to 3.2.7 but is now broken in all versions since.
Comment 7 Rodrigo Kumpera 2014-08-15 01:07:44 UTC
Waiting is only available for process creation and not for shell execution. Since your sample asks for an app to be launched and not a process to be executed, waiting is not available. This is the same behavior as of MS and it was introduced to fix issues with shell executing web pages leaving zombies behind.