visualstudio.xunit icon indicating copy to clipboard operation
visualstudio.xunit copied to clipboard

Testhost process exited with error: Unhandled exception. System.Net.Sockets.SocketException (10022): An invalid argument was supplied.

Open fushiwara-risu opened this issue 3 years ago • 0 comments

When I run my tests with dotnet test I get the following error and see (0 passed, 0 failed, 0 skipped)

  Determining projects to restore...
  Restored Z:\Source\AutoBackup\AutoBackup.Test\AutoBackup.Test.csproj (in 393 ms).
  2 of 3 projects are up-to-date for restore.
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  AutoBackup.Test -> Z:\Source\AutoBackup\AutoBackup.Test\bin\Debug\net6.0\AutoBackup.Test.dll
Test run for Z:\Source\AutoBackup\AutoBackup.Test\bin\Debug\net6.0\AutoBackup.Test.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.2.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Testhost process exited with error: Unhandled exception. System.Net.Sockets.SocketException (10022): An invalid argument was supplied.
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at System.Net.Sockets.Socket..ctor(SocketType socketType, ProtocolType protocolType)
   at System.Net.Sockets.TcpClient.InitializeClientSocket()
   at System.Net.Sockets.TcpClient..ctor(AddressFamily family)
   at System.Net.Sockets.TcpClient..ctor()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.SocketClient..ctor(Func`2 channelFactory)
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.SocketClient..ctor()
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.CommunicationEndpointFactory.Create(ConnectionRole role)
   at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestHandler.InitializeCommunication()
   at Microsoft.VisualStudio.TestPlatform.TestHost.DefaultEngineInvoker.Invoke(IDictionary`2 argsDictionary)
   at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Run(String[] args)
   at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Main(String[] args)
. Please check the diagnostic logs for more information.

Test Run Aborted.

I have tried reinstalling visualstudio, using an older version of both xunit and visualstudio, and was only able to get it to work after trying it on another computer.

fushiwara-risu avatar May 03 '22 19:05 fushiwara-risu