title: C# async task not starting on Directory.Exists
body: <p>I am currently having some issues with the intranet and some network drivers usually start to hang after a while</p>
  
  <p>I did the following code in order check async if the given path is accessible or not but now there seems to be a new issue.
  Sometimes the task doesn't start at all, and on break it says that its queued to start. This happens only on few machines, not on all, that's why the confusion </p>
  
  <pre><code>public static class PingHelper
  {
      private static Task RealTask { get; set; }
      public static bool IsAvailable { get; set; }
  
      public static async Task Check(string location, int timeout)
      {
          if (RealTask == null)
          {
              DirectoryInfo directoryInfo = new DirectoryInfo(location);
  
              RealTask = Task.Run(() =&gt;
              {
                  var result = directoryInfo.Exists;
              });
  
              Task dummyTask = Task.Delay(timeout);
  
              if (dummyTask != await Task.WhenAny(RealTask, dummyTask))
              {
                  RealTask = null;
                  IsAvailable = true;
              }
  
              return;
          }
  
          if (RealTask.IsCompleted)
          {
              RealTask = null;
          }
  
          IsAvailable = false;
  
      }
  
  }
  </code></pre>
  
  <p>The code should create a task, check after x miliseconds if it returned successfully or not, also if a task is already existing an hanging on Directory.Exists, just assume its still hanging and return false immediately.</p>
  
  <p>So basically I am not sure what is the root cause of the problem, the ThreadPool is set to 1024 and during break there are like only 3 tasks running, so it wont be case of overpopulating tasks</p>