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 2258 [details]
The Process object obtained by Process.GetProcessById on OSX does not behave correctly. Specifically, the Exited event fires immediately after it is assigned and EnableRaisingEvents is set. Also, WaitForExit returns immediately.
Attached is a little test case. Here is the result I see from running it:
alex@dynamic-028:Desktop $ mcs foo.cs
alex@dynamic-028:Desktop $ mono foo.exe
Child pid: 6567
Child pid: 6568
Grandchild pid: 6568
Elapsed ms: 33
alex@dynamic-028:Desktop $ ps -A |grep mono
6568 ttys005 0:00.01 /usr/bin/mono /Users/alex/Desktop/foo.exe 2
6573 ttys005 0:00.00 grep mono
(It returns immediately even though the grandchild process was sleeping for 10sec.)
This is a known limitation.
The problem is that it is only possible to call waitpid on child processes, so the only other way of waiting is to poll for pid existance (and this has not been implemented).
We might use kqueue(2) on OSX
We gave up on kqueue due to the file descriptor limit. We're now going to do it using the CoreFX implementation instead that uses FSEvent.