title: HttpClient - A task was cancelled?
body: <p>It works fine when have one or two tasks however throws an error "A task was cancelled" when we have more than one task listed.</p>
  
  <p><img src="https://i.stack.imgur.com/zZojw.png" alt="enter image description here"></p>
  
  <pre><code>List&lt;Task&gt; allTasks = new List&lt;Task&gt;();
  allTasks.Add(....);
  allTasks.Add(....);
  Task.WaitAll(allTasks.ToArray(), configuration.CancellationToken);
  
  
  private static Task&lt;T&gt; HttpClientSendAsync&lt;T&gt;(string url, object data, HttpMethod method, string contentType, CancellationToken token)
  {
      HttpRequestMessage httpRequestMessage = new HttpRequestMessage(method, url);
      HttpClient httpClient = new HttpClient();
      httpClient.Timeout = new TimeSpan(Constants.TimeOut);
  
      if (data != null)
      {
          byte[] byteArray = Encoding.ASCII.GetBytes(Helper.ToJSON(data));
          MemoryStream memoryStream = new MemoryStream(byteArray);
          httpRequestMessage.Content = new StringContent(new StreamReader(memoryStream).ReadToEnd(), Encoding.UTF8, contentType);
      }
  
      return httpClient.SendAsync(httpRequestMessage).ContinueWith(task =&gt;
      {
          var response = task.Result;
          return response.Content.ReadAsStringAsync().ContinueWith(stringTask =&gt;
          {
              var json = stringTask.Result;
              return Helper.FromJSON&lt;T&gt;(json);
          });
      }).Unwrap();
  }
  </code></pre>