title: co_await HttpClient::PutAsync never completes (using c++, coroutine, UWP)
body: <p>I do http requests and when they fail I repeat the requests. I simulate it by unplugging the internet cable to my computer and replugging it. Most of the time my code works, but sometimes</p>
  
  <p>co_await HttpClient::PutAsync() never "returns" or completes.</p>
  
  <p>My code looks something like this: </p>
  
  <pre><code>task&lt;Aws::Result&gt; Aws::S3Request::tryExecute()
  {
      // content
      IHttpContent^ httpContent;
      httpContent = ref new HttpBufferContent(mBufferContent);
      httpContent-&gt;Headers-&gt;ContentType = ref new Headers::HttpMediaTypeHeaderValue(ref new String(mContentType.c_str()));
  
      std::wstring signature = getSignature();
  
      // client
      auto filter = ref new ::Filters::HttpBaseProtocolFilter;
      filter-&gt;AllowUI = false;
      filter-&gt;CacheControl-&gt;ReadBehavior = Filters::HttpCacheReadBehavior::NoCache;
      filter-&gt;CacheControl-&gt;WriteBehavior = Filters::HttpCacheWriteBehavior::NoCache;
      HttpClient^ httpClient = ref new HttpClient(filter);
      httpClient-&gt;DefaultRequestHeaders-&gt;Authorization = ref new Headers::HttpCredentialsHeaderValue(L"AWS", ref new String((mUser.mAccessKey + L":" + signature).c_str()));
      httpClient-&gt;DefaultRequestHeaders-&gt;Append(L"Date", ref new String(mDate.c_str()));
      httpClient-&gt;DefaultRequestHeaders-&gt;Append(L"x-amz-acl", L"public-read");
      httpClient-&gt;DefaultRequestHeaders-&gt;Append(L"x-amz-security-token", ref new String(mUser.mSessionToken.c_str()));
  
      // http req
      Uri^ uri = ref new Uri(ref new String(mUri.c_str()));
      HttpResponseMessage^ response;
      IAsyncOperationWithProgress&lt;HttpResponseMessage^, HttpProgress&gt;^ progress;
      try
      {
          progress = httpClient-&gt;PutAsync(uri, httpContent);
          progress-&gt;Progress = ref new AsyncOperationProgressHandler&lt;HttpResponseMessage^, HttpProgress&gt;(
              [this](IAsyncOperationWithProgress&lt;HttpResponseMessage^, HttpProgress&gt;^ pretask, HttpProgress progressInfo)
          {
              /*double got = progressInfo.BytesReceived + progressInfo.BytesSent;
              double total = 0;
              if (progressInfo.TotalBytesToReceive)
              total += progressInfo.TotalBytesToReceive-&gt;Value;
              if (progressInfo.TotalBytesToSend)
              total += progressInfo.TotalBytesToSend-&gt;Value;
              float progress = (total &gt;= 1) ? float(got / total) : 0.0f;
              debugOut("--- part progress = ", progress);
              if (mProgress)
              *mProgress = progress;*/
          }
          );
          response = co_await progress;
          progress = nullptr;
          if (!response-&gt;IsSuccessStatusCode)
              debugOut("--- http fail error");
      }
      catch (Platform::COMException^)
      {
          debugOut("--- http fail nointernet");
          progress = nullptr;
          mResult = NoInternet;
          mAnswer.clear();
          co_return mResult;
      }
  
      // answer
      mAnswer = response-&gt;Content-&gt;ToString()-&gt;Data();
      debugOut(L"--- Http answer=", mAnswer);
      mResult = response-&gt;IsSuccessStatusCode ? Success : Error;
  
      co_return mResult;
  }
  </code></pre>
  
  <p>If it fails, tryExecute() is called again.</p>
  
  <p>By the way, the IAsyncOperationWithProgress only gives me either 0% or 100% and not the inbetweens. I upload sizes of 5 Mbytes in each request.</p>