Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
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.
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.
Where is the InvalidOperationException the documented behavior?
From actually testing the MS implementation.
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?
Now the correctly behavior, which is throwing an exception, happens.
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.
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.