I have a C# windows service application which is interating the below code in a "foreach" loop (I got about 300 addresses to check) to determine if an IP address is reachable over the interent, unfortenutlly I get the blue screen of death, my PC crash while I debug this on Visual Studio 2019 , error code : PROCESS HAS LOCKED PAGES
public bool IsReachablePing()
{
try
{
using Ping p = new();
PingReply reply = p.Send(IpAddress);
if (reply.Status == IPStatus.Success) { return true; }
return false;
}
catch (Exception) { return false; }
}
How can I make this more friendly to the mechine in order to avoid a server crash in case I publish the service ? I'm afaraid to post this service on the server