title: DotNetCore 3 WorkItemTrackingHttpClient occasionally throws "Authentication failed because the remote party has closed the transport stream" exception
body: <p>I have the following method:</p>
  
  <pre><code>public static WorkItem GetWorkItem(int workItemId, bool relations)
  {
      Uri accountUri = new Uri(URL);
      string personalAccessToken = PERSONAL_ACCESS_TOKEN;
      VssConnection connection = new VssConnection(accountUri, new VssBasicCredential(string.Empty, 
      personalAccessToken));
      var client = connection.GetClient&lt;WorkItemTrackingHttpClient&gt;();
      WorkItemExpand? expand = relations ? WorkItemExpand.Relations : (WorkItemExpand?)null;
      return client.GetWorkItemAsync(workItemId, null, null, expand).Result;
  }
  </code></pre>
  
  <p>Basically I am using the <em>Microsoft.TeamFoundationServer.Client</em> nuget package to get a workitem from our companies Azure Devops project.</p>
  
  <p>Most of the time this method works fine, however occasionally (Meaning once in every five or so attempts) the client.GetWorkItemAsync() method will fail with the error:</p>
  
  <pre><code>Message:"One or more errors occurred. (The SSL connection could not be established, see inner exception.)"
  Source:"System.Private.CoreLib"
  InnerException:
  {
      Message:"Authentication failed because the remote party has closed the transport stream."
      Source:"System.Net.Security"
      InnerException:null
  }
  </code></pre>
  
  <p>This has only started occuring after I updated my project from targeting Dot Net Core 2.1 to Dot Net Core 3.1</p>
  
  <p>My question is what can I do to solve this issue? Is this an problem with Microsoft's <em>Microsoft.TeamFoundationServer.Client</em> nuget package, or am I doing something wrong?</p>
  
  <p>As a temporary solution I seem to be able to simply repeatedly call the method until it works but I would rather not have to do that.</p>
  
  <p>Any help is appreciated, Thanks.</p>
  
  <p>EDIT:</p>
  
  <p>To further test this issue I downgraded my project from Dot Net Core 3.1 to Dot Net Core 2.1 and ran the method 10 times and it never threw any error. No code changes. Then, I upgraded my project from Dot Net Core 2.1 back to Dot Net Core 3.1 and ran the method. I Immediately got this error again.</p>
  
  <p>Unless I am missing something, I can only conclude somehow the Dot Net Core change has broken this method.</p>