Skip to content

17.11+ System.IO.IOException: Connection forcibly closed by remote host #10402

Open
@Sterlinghv

Description

@Sterlinghv

Issue Description

After upgrading Microsoft.NET.Test.Sdk from version 17.10.0 to 17.11.0, our AzureDevOps test pipeline task encounters a System.IO.IOException at the very beginning of the run.

Steps to Reproduce

Use Microsoft.NET.Test.Sdk version 17.11.0 or above
Run dotnet test via the DotNetCoreCLI@2 in an AzureDevOps pipeline:

  - task: DotNetCoreCLI@2
    displayName: dotnet test
    inputs:
      command: test
      projects: <project solution>

Expected Behavior

Test run as expected with no IO exception at the start

Actual Behavior

Error seen in the AzureDevops test pipeline log:

System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host..
 ---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.BufferedStream.Flush()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.SocketCommunicationManager.WriteAndFlushToChannel(String rawMessage) in /_/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs:line 413
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.DataCollection.DataCollectionRequestSender.SendAfterTestRunEndAndGetResult(ITestMessageEventHandler runEventsHandler, Boolean isCancelled) in /_/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionRequestSender.cs:line 155
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.ProxyDataCollectionManager.<>c__DisplayClass20_0.<AfterTestRunEnd>b__0() in /_/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs:line 155
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.ProxyDataCollectionManager.InvokeDataCollectionServiceAction(Action action, ITestMessageEventHandler runEventsHandler) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs:line 288

Environment

Windows Server 2016 inside a AzureDevOps agent pipeline job

Additional Notes

This is not happening on version 17.10.0 or presumably earlier. Seems to be happening at ProxyDataCollectionManager.cs line 288

I'm not sure what is trying to be written/connected when the issue happens

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions