title: Crash inside http_client constructor (Casablanca SDK)
body: <p>I'm trying to use Casablanca to consume a REST api. 
  I've been following the microsoft tutorial, how ever i'm getting a crash and I cannot figure it out.</p>
  
  <p>I'm using visual studio 2017 with C++11</p>
  
  <p>I've codded a function GetRequest() that do work when used in a new empty project, but when I try to use it on my Project (Very big project with millions of code lines).
  I'm crashing in the constructor of http_client, in the file xmemory0 line 118.</p>
  
  <pre><code>const uintptr_t _Ptr_container = _Ptr_user[-1];
  </code></pre>
  
  <p>This is a link to the callstack : <a href="https://i.imgur.com/lBm0Hv7.png" rel="nofollow noreferrer">https://i.imgur.com/lBm0Hv7.png</a></p>
  
  <pre><code>void RestManager::GetRequest()
  {
      auto fileStream = std::make_shared&lt;ostream&gt;();
  
      // Open stream to output file.
      pplx::task&lt;void&gt; requestTask = fstream::open_ostream(U("results.html")).then([=](ostream outFile)
      {
          *fileStream = outFile;
  
          // Create http_client to send the request.
          http_client client(U("XXX/XXX.svc/"));
  
          // Build request URI and start the request.
          uri_builder builder(U("/IsLive"));
          builder.append_query(U("q"), U("cpprestsdk github"));
          return client.request(methods::GET, builder.to_string());
      })
  
          // Handle response headers arriving.
          .then([=](http_response response)
      {
          printf("Received response status code:%u\n", response.status_code());
  
          // Write response body into the file.
      return response.body().read_to_end(fileStream-&gt;streambuf());
      })    
  
          // Close the file stream.
          .then([=](size_t)
      {
          return fileStream-&gt;close();
      });
  
      // Wait for all the outstanding I/O to complete and handle any exceptions
      try
      {
          requestTask.wait();
      }
      catch (const std::exception &amp;e)
      {
          printf("Error exception:%s\n", e.what());
      }
  
  }
  </code></pre>
  
  <p>EDIT : I just want to add that the http_client constructor is the issue. It always crash inside it no matter what I send as parameter. </p>
  
  <p>The wierd thing is that it's not crashing when i just make a main() that call this function.
  I guess it must be due to some memory issues, however I have no idea how could I debug that.
  Does anyone would have an idea about it?</p>
  
  <p>Thanks and have a great day!</p>