title: Exception: This instance has already started one or more requests. Properties can only be modified before sending the first request
body: <p>I am using the <a href="https://github.com/checkout/checkout-net-library" rel="nofollow noreferrer">Checkout.com .NET SDK</a> to integrate my application with their REST API. I have written a proof-of-concept application and everything works fine, but when I try from the actual application I get this error when trying to make API calls: </p>
  
  <p><em>"This instance has already started one or more requests. Properties can only be modified before sending the first request."</em></p>
  
  <p>I have cloned the source code, built locally, replaced the nuget reference with my local reference and debugged. The exception is thrown when the WebRequestHandler is created:</p>
  
  <pre><code>requestHandler = new WebRequestHandler
  {
      AutomaticDecompression = DecompressionMethods.GZip,
      AllowAutoRedirect = false,
      UseDefaultCredentials = false,
      UseCookies = false
  };
  </code></pre>
  
  <p>The application is using .NET 4.0, Microsoft.Net.HTTP 2.2.29. The only place I can find the code for this to dig further is on <a href="https://www.symbolsource.org/Public/Metadata/NuGet/Project/HttpClient/0.5.0/Release/.NETFramework,Version=v4.0/Microsoft.Net.Http" rel="nofollow noreferrer">symbolsource.org</a>. In HttpClientHandler there is a volatile bool operationStarted which is only set when Send is called, and throws an exception if you modify the properties when it is set.</p>
  
  <pre><code>internal void CheckDisposedOrStarted()
  {
      CheckDisposed();
      if (operationStarted)
      {
          throw new InvalidOperationException(SR.net_http_client_operation_started);
      }
  }
  </code></pre>
  
  <p>I'm confident that this code is not being called before I hit it the first time, so I can only surmise that <strong>something</strong> else in my application is already making a call with HttpClient and it hasn't been disposed, but I don't know how to find out what without deconstructing the application piece by piece, which is a mammoth task.</p>
  
  <p>I would like to debug the Microsoft.Net.Http 2.2.29 for .NET 4.0 code to try to find the culprit but can't find the source code in complete and downloadable format. I could try to construct it from the code on symbolsource.org but that's not ideal.</p>
  
  <p>Could someone direct me to the source code? Or suggest any other ideas?
  Thanks.</p>