[Mono-bugs] [Bug 596779] New: InvalidOperationException in Process.GetProcessesByName

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Apr 14 19:36:16 EDT 2010



           Summary: InvalidOperationException in
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: rkvinge at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Opera/9.80 (X11; Linux x86_64; U; en) Presto/2.2.15

Calling Process.GetProcessesByName might throw spurious
InvalidOperationExceptions. This happens when it tries to get the process name
of a process, and that process has already exited.


1) Start something that'll create a process frequently. For instance:

while echo again; do sleep 1; echo once again; done

2) Execute Process.GetProcessByName a few times. For instance using csharp:
csharp> new List<System.Diagnostics.Process>
(System.Diagnostics.Process.GetProcessesByName ("bash")).ForEach ((v) =>
Console.WriteLine (v.ProcessName));

I get an exception in about ~25% of the runs, this is the exception:

System.InvalidOperationException: Process has exited, so the requested
information is not available.
  at System.Diagnostics.Process.get_ProcessName () [0x00000] in <filename
  at (wrapper remoting-invoke-with-check)
System.Diagnostics.Process:get_ProcessName ()
  at System.Diagnostics.Process.GetProcessesByName (System.String processName)
[0x00000] in <filename unknown>:0 
  at Class67.Host (System.Object& $retval) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object&
result, System.Boolean& result_set) [0x00000] in <filename unknown>:0 
  at Mono.CSharpShell.Evaluate (System.String input) [0x00000] in <filename

Reproducible: Always

Configure bugmail: http://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