有时当我运行测试(使用 XUnit 的 .Net Standard 2.0 项目(时,我在测试输出窗格中收到错误,指出:
[25.09.2018 1:46:36 错误] System.IO.IOException:管道的另一端没有进程。
然后,在重新启动Visual Studio之前,我无法再运行测试。 以下是错误的完整堆栈跟踪:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
at System.Console.get_ForegroundColor()
at Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.SetColorForAction(ConsoleColor foregroundColor, Action action)
at Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.Warning(IOutput output, Boolean appendPrefix, String format, Object[] args)
at Microsoft.VisualStudio.TestPlatform.CommandLine.Internal.ConsoleLogger.RaiseTestRunWarning(String warningMessage)
at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.UpdateRunSettingsIfRequired(String runsettingsXml, List`1 sources, String& updatedRunSettingsXml)
at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.RunTests(TestRunRequestPayload testRunRequestPayload, ITestHostLauncher testHostLauncher, ITestRunEventsRegistrar testRunEventsRegistrar, ProtocolConfig protocolConfig)
at Microsoft.VisualStudio.TestPlatform.Client.DesignMode.DesignModeClient.<>c__DisplayClass19_0.<StartTestRun>b__0()
我能做些什么来摆脱这种烦人的行为吗?
对我来说,重新启动VS 2017有助于摆脱此错误,完全相同的错误。
只需将Visual Studio 2017更新到最新版本,这个令人讨厌的错误就消失了。