[Mono-bugs] [Bug 547120] New: System.Net.NetworkInformation.Ping throws InvalidOperationException "Process has not been started" on OSX

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 15 02:04:31 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=547120

User marius.golea at yahoo.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=547120#c486904

           Summary: System.Net.NetworkInformation.Ping throws
                    InvalidOperationException "Process has not been
                    started" on OSX
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: marius.golea at yahoo.com
         QAContact: mono-bugs at lists.ximian.com
                CC: gonzalo at novell.com
        Depends on: 486904
          Found By: ---


This bug is still reproducing on MAC OS X 10.5.8 with Mono 2.4.3_6.

I've tested with the following code:

using System;
using System.Net.NetworkInformation;


namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
        Console.WriteLine("Environment.OSVersion.Platform : " + (int)
Environment.OSVersion.Platform);
            Ping x = new Ping();
            PingReply response = x.Send("www.google.com");
            Console.WriteLine(response.Status.ToString());
        }
    }
}

Results:

Environment.OSVersion.Platform : 4

Unhandled Exception: System.InvalidOperationException: Process has not been
started.
  at System.Diagnostics.Process.get_HasExited () [0x0003b] in
/private/tmp/monobuild/build/BUILD/mono-2.4.2.3/mcs/class/System/System.Diagnostics/Process.cs:205 
  at (wrapper remoting-invoke-with-check)
System.Diagnostics.Process:get_HasExited ()
  at System.Net.NetworkInformation.Ping.SendUnprivileged (System.Net.IPAddress
address, Int32 timeout, System.Byte[] buffer,
System.Net.NetworkInformation.PingOptions options) [0x000fd] in
/private/tmp/monobuild/build/BUILD/mono-2.4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:283 
  at System.Net.NetworkInformation.Ping.Send (System.Net.IPAddress address,
Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions
options) [0x00067] in
/private/tmp/monobuild/build/BUILD/mono-2.4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:190 
  at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress,
Int32 timeout, System.Byte[] buffer, System.Net.NetworkInformation.PingOptions
options) [0x00007] in
/private/tmp/monobuild/build/BUILD/mono-2.4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:165 
  at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress,
Int32 timeout, System.Byte[] buffer) [0x00000] in
/private/tmp/monobuild/build/BUILD/mono-2.4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:159 
  at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress,
Int32 timeout) [0x00000] in
/private/tmp/monobuild/build/BUILD/mono-2.4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:154 
  at System.Net.NetworkInformation.Ping.Send (System.String hostNameOrAddress)
[0x00000] in
/private/tmp/monobuild/build/BUILD/mono-2.4.2.3/mcs/class/System/System.Net.NetworkInformation/Ping.cs:149 
  at (wrapper remoting-invoke-with-check)
System.Net.NetworkInformation.Ping:Send (string)
  at ConsoleApplication.Program.Main (System.String[] args) [0x00000] 

The application was terminated by a signal: SIGHUP

In Ping.cs I see that in BuildPingArgs method is tested that the code is
running on Mac OS using "bool is_mac = ((int) Environment.OSVersion.Platform ==
6);" but in my test application I get from Environment.OSVersion.Platform - 4
(UNIX). Maybe this is the problem....



+++ This bug was initially created as a clone of Bug #486904 +++

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.7)
Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)

The problem occurs when calling Send(). Here's some source/sudo code that
reproduces the problem.

string machineName = "some_machine";
Ping ping = new Ping();
PingReply reply = ping.Send( machineName, 500 ); // throws the exception


I took a look through the Mono source for the Ping class, and I'm assuming that
the SendUnprivileged option is being used because it uses an actual ping
Process. I think the problem might be in the BuildPingArgs function, because
the arguments it's using are from the Linux version of ping. The OSX version
has different usage options:

usage: ping [-AaDdfnoQqRrv] [-c count] [-i wait] [-l preload] [-M mask | time]
            [-m ttl] [-p pattern] [-S src_addr] [-s packetsize]
            [-t timeout] [-z tos] host
       ping [-AaDdfLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]
            [-M mask | time] [-m ttl] [-p pattern] [-S src_addr]
            [-s packetsize] [-T ttl] [-t timeout] [-z tos] mcast-group


Reproducible: Always

Steps to Reproduce:
1. See source above. The line that sends the ping results in the exception.
Actual Results:  
InvalidOperationException "Process has not been started"

Expected Results:  
Not throw an exception, and return the appropriate PingReply result.

-- 
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