[Mono-bugs] [Bug 657852] New: System.Diagnostics.Process HasExited property always returns true

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Dec 6 18:27:41 EST 2010



           Summary: System.Diagnostics.Process HasExited property always
                    returns true
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.8.x
          Platform: VMWare
        OS/Version: SuSE Linux 10.1
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: novel at andrewrondeau.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US)
AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10

I'm seeing this on both the official VMware VM for 2.8.1, and 64-bit Ubuntu
where I built 2.8.1 from scratch.

- System.Diagnostics.Process.HasExited always returns true.
- System.Diagnostics.Process.Exited is triggered even when the parent process
hasn't exited.
- System.Diagnostics.Process.GetCurrentProcess().Kill(); throws a "The process
already finished" exception. (This never happens on .Net)

These bugs effectively prevent using System.Diagnostics.Process to monitor and
manage other processes within Mono!!!

Reproducible: Always

Steps to Reproduce:
1 - Use Process.GetProcessById(some ID); with a running process
2 - Observe that HasExited is true.


Here are some helper programs. Use the first one to get a process running and
obtain its process id. Pass the process ID as a command-line argument to the
second program. It will demonstrate that HasExited is true even when
DummyProcess is running.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading;

namespace DummyProcess
    class MainClass
        public static void Main (string[] args)
            Console.WriteLine("Process ID: {0}",


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading;

using Mono.Unix;
using Mono.Unix.Native;

namespace ProcessKiller
    class Program
        static void Main(string[] args)
        int parentProcessId = Convert.ToInt32(args[0]);

        Process parent;
            parent = Process.GetProcessById(parentProcessId);
        catch (ArgumentException)
            // If the parent process can't be obtained, just return.  It means
that the parent process is done



Actual Results:  
HasExited is always true

Expected Results:  
HasExited should be false until the process exits

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list