From: Tomas Weinfurt Date: Tue, 12 Mar 2019 19:16:12 +0000 (-0700) Subject: Fix SendWithPingUtilityAsync to catch InvalidOperationException (dotnet/corefx#35992) X-Git-Tag: submit/tizen/20210909.063632~11031^2~2201 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b601dc8f2888237c1b5beb5075e3a2b64462d4b9;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix SendWithPingUtilityAsync to catch InvalidOperationException (dotnet/corefx#35992) * ignore InvalidOperationException from Kill * ignore InvalidOperationException from Kill Commit migrated from https://github.com/dotnet/corefx/commit/0f7a0bd5fb4892c1434e263824d394ab621a1b2a --- diff --git a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Unix.cs b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Unix.cs index 6da5928..3a4e3ca 100644 --- a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Unix.cs +++ b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Unix.cs @@ -328,12 +328,13 @@ namespace System.Net.NetworkInformation if (finished == timeoutTask && !p.HasExited) { // Try to kill the ping process if it didn't return. If it is already in the process of exiting, - // a Win32Exception will be thrown. + // a Win32Exception will be thrown or we will get InvalidOperationException if it already exited. try { p.Kill(); } catch (Win32Exception) { } + catch (InvalidOperationException) { } return CreateTimedOutPingReply(); } else