diff --git a/Lagrange.Core/Utility/Network/Icmp.cs b/Lagrange.Core/Utility/Network/Icmp.cs index 4bf2701a6..a8d17ded5 100644 --- a/Lagrange.Core/Utility/Network/Icmp.cs +++ b/Lagrange.Core/Utility/Network/Icmp.cs @@ -6,8 +6,15 @@ internal static class Icmp { public static async Task PingAsync(Uri hostIp, int timeout = 1000) { - using var ping = new Ping(); - var reply = await ping.SendPingAsync(hostIp.Host, timeout); - return reply?.RoundtripTime ?? long.MaxValue; + try + { + using var ping = new Ping(); + var reply = await ping.SendPingAsync(hostIp.Host, timeout); + return reply?.RoundtripTime ?? long.MaxValue; + } + catch (PlatformNotSupportedException) + { + return long.MaxValue; + } } } \ No newline at end of file