title: ChromeDriver times out instantly when using Task.Run() with await Task.WhenAll()
body: <p>I'm trying to navigate to pages in parallel with ChromeDriver but as soon as I add &quot;await&quot; in front of the Task.WhenAll() call the driver times out within 1-2 seconds, not even close to the configured 120s timeout. What could be the reason for this and how can I fix it?</p>
  <p>Using Task.WhenAll(..).Wait(..) seems to work fine. Why is that?</p>
  <pre><code>    var pages = new List&lt;Task&gt;();
      for (var i = 0; i &lt; driverCount; i++)
      {
          var driver = _drivers[i];
          var url = urls[urlIndex++];
          Console.WriteLine($&quot;{category.ToUpper()}: {urlIndex} of {urlCount} =&gt; {url}&quot;);
  
          pages.Add(Task.Run(() =&gt;
          {
              try
              {
                  driver.Navigate().GoToUrl(url);
  
              }
              catch (Exception e)
              {
                  Console.WriteLine(&quot;Navigate() EXCEPTION:&quot; + e);
                  QuitAllChromeDrivers();
                  throw;
              }
              
              Console.WriteLine($&quot;Parsing: {driver.Url} - {driver.Title}&quot;);
              
              // parsing here ...
          }));
      }
  
      await Task.WhenAll(pages);
  </code></pre>
  <pre><code>    OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:52594/session/5c138e57c554ccfd59a45b243512c476/title timed out after 120 seconds.
       ---&gt; System.Threading.Tasks.TaskCanceledException: The operation was canceled.
       ---&gt; System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
       ---&gt; System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
         --- End of inner exception stack trace ---
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)
         at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         --- End of inner exception stack trace ---
         at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
         at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
         at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)
         at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
         at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
         --- End of inner exception stack trace ---
         at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
         at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
         at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
         at OpenQA.Selenium.WebDriver.get_Title()
         at UnityAssetStoreScraper.Program.&lt;&gt;c__DisplayClass9_1.&lt;ScrapeAssetContent&gt;b__0() in C:\Users\Mee\RiderProjects\Scraper\Scraper\Program.Content.cs:line 74
         at System.Threading.Tasks.Task.InnerInvoke()
         at System.Threading.Tasks.Task.&lt;&gt;c.&lt;.cctor&gt;b__277_0(Object obj)
         at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
  </code></pre>