title: Handle "A task was canceled" exception
body: <p>My C# app uploads file to some API, I'm using multipart request, i.e I'm uploading a json string and binary contect of the file, it works fine for most files, but for very few it gives exception, I mean let's try for file named <code>50MB.zip</code>
  I'm getting the exception:</p>
  <pre><code>A task was canceled. :::  ::: System.Threading.Tasks.TaskCanceledException: A task was canceled.
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
  </code></pre>
  <p>My code looks roughly as follows:</p>
  <pre><code>public async Task&lt;Dictionary&lt;string , string&gt;&gt; Upload(string filePath)
  {   
      FileInfo fi = new FileInfo(FilePath);
      string jsonString=&quot;some json string&quot;;
      byte[] fileContents=File.ReadAllBytes(fi.FullName);
      Uri webService = new Uri(url);
      HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Post , webService);
      requestMessage.Method = HttpMethod.Post;
      requestMessage.Headers.Add(&quot;Authorization&quot; , &quot;MyKey1234&quot;);
      const string boundry = &quot;------------------My-Boundary&quot;;
      MultipartFormDataContent multiPartContent = new MultipartFormDataContent(boundry);
      ByteArrayContent byteArrayContent = new ByteArrayContent(fileContents);
      multiPartContent.Add(byteArrayContent);
      requestMessage.Content = multiPartContent;
      HttpClient httpClient = new HttpClient();
      HttpResponseMessage httpResponse = await httpClient.SendAsync(requestMessage , HttpCompletionOption.ResponseContentRead , CancellationToken.None);
      //exception in this line ^
      return new Dictionary&lt;string , string&gt;();
  }
  </code></pre>
  <p>The caller:</p>
  <pre><code>myDictionary = await Upload(filePath);
  </code></pre>
  <p>The structure of the console app is as follows:</p>
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          MainAsync().Wait();
      }
  
      static async Task MainAsync()
      {
          new MyClass().Start();
      }
  }
  </code></pre>
  <p>And inside <code>MyClass:</code></p>
  <pre><code>public async void Start()
  {
      myDictionary = await Upload(filePath);
  }
  </code></pre>
  <p>I guess I'm not using async correctly, can you maybe see what I'm missing? any ideas?</p>