我已经从 Visual Studio 2022 的测试资源管理器中运行了我的测试项目,幸运的是所有测试都通过了。另一方面,我正在尝试使用vstest.console.exe运行MyProject.Tests.build.appxrecipe文件,但它失败了。
日志如下:
The active test run was aborted. Reason: Unable to communicate with test host process.
Closing app with package full name 'b99a209c-7a2d-42fa-ba34-b16c8dee0379_1.0.0.0_x64__amhbm8v6a514r'.
Test Run Aborted with error System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.Stream.ReadByte()
at System.IO.BinaryReader.ReadByte()
at System.IO.BinaryReader.Read7BitEncodedInt()
at System.IO.BinaryReader.ReadString()
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.LengthPrefixCommunicationChannel.NotifyDataAvailable()
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TcpClientExtensions.MessageLoopAsync(TcpClient client, ICommunicationChannel channel, Action`1 errorHandler, CancellationToken cancellationToken)
--- End of inner exception stack trace ---.
Total tests: Unknown
Passed: 152
Total time: 29.0509 Seconds
类似于此GitHub 问题。