title: Dotnet Test not terminating in Azure Pipelines
body: <p>In our pipeline for the past 3 weeks, the dotnet test task has not been terminating at all, and we are forced to cancel the pipeline.</p>
  <p>We have observed this log, which we had not seen prior to 3 weeks: (No changes have been made in these 3 weeks at all, either to our code or to Windows on our on premise agent, SQL Server or any other service in the agent).</p>
  <p><em>The STDIO streams did not close within 10 seconds of the exit event from process 'C:\AzAgent_work_tool\dotnet\dotnet.exe'. This may indicate a child process inherited the STDIO streams and has not yet exited.</em></p>
  <p><em>##[error]Error: The process 'C:\AzAgent_work_tool\dotnet\dotnet.exe' failed with exit code 1</em></p>
  <p>All the tests in the task pass though.</p>
  <p><em>Publishing test results to test run '1033120'.
  TestResults To Publish 233, Test run id:1033120
  Test results publishing 233, remaining: 0. Test run id: 1033120
  Published Test Run : </em></p>
  <p>The test results are published.</p>
  <p>We have observed this in the logs:</p>
  <p>*##[warning].NET 5 has some compatibility issues with older Nuget versions(&lt;=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(&lt;=3) to build</p>
  <p>Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: <a href="https://docs.microsoft.com/en-us/dotnet/core/tools/" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/core/tools/</a> and <a href="https://docs.microsoft.com/en-us/dotnet/core/compatibility/" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/core/compatibility/</a> . To learn about more such changes and troubleshoot, refer here: <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting</a>*</p>
  <p>Hence we added this in our yaml before the test task, as our app is built with .NET Core 3.1:</p>
  <pre><code>- task: UseDotNet@2
        inputs:
          packageType: sdk
          version: 3.x
          installationPath: $(Agent.ToolsDirectory)/dotnet
        displayName: 'Installing .net core sdk 3.x'
        condition: succeeded()
  </code></pre>
  <p>I did a little investigation and found this link on the MS github page: <a href="https://github.com/microsoft/azure-pipelines-tasks/issues/13033" rel="nofollow noreferrer">https://github.com/microsoft/azure-pipelines-tasks/issues/13033</a></p>
  <p>We have set these variables: TASKLIB_TEST_TOOLRUNNER_EXITDELAY 60000</p>
  <ul>
  <li>name: 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS'
  value: 30
  <ul>
  <li>name: 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS'
  value: 30</li>
  </ul>
  </li>
  </ul>
  <p>No effect yet. How can we solve this issue? It is not affecting our release but we would like to have a green pipeline? Tips on this would be greatly helpful</p>