[Mono-dev] Ping throwing exception

Gladish, Jacob Jacob.Gladish at sig.com
Mon Sep 28 12:22:58 EDT 2009

I'm getting an exception from an application that is repeatedly running pings. The Ping class looks like it'll switch between invoking /bin/ping and sending an ICMP directly depending on the user. I'm running as a non-privileged user, therefore, its exec'ing ping. Every once in a while I get an "unknown" response, and have tracked it back to Ping.cs -- the code snippet below. The only way I can see this failing is if WaitForSingleObjectEx is broken for processes. The timeout being used is 4000, which is the default.

Does anyone know if there are any outstanding issues with WaitForSingleObjectEx and processes.

System.InvalidOperationException: The process must exit before getting the requested information.
  at System.Diagnostics.Process.get_ExitCode () [0x00000]
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:get_ExitCode ()
  at MassPinger.Ping.SendUnprivileged (System.Net.IPAddress address, Int32 timeout, System.Byte[] buffer, MassPinger.PingOptions options) [0x00000]


if (!ping.WaitForExit (timeout) || ping.ExitCode == 2) {
               return new PingReply (address, buffer, options, trip_time, System.Net.NetworkInformation.IPStatus.TimedOut);

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

More information about the Mono-devel-list mailing list