【发布时间】:2015-02-20 02:06:04
【问题描述】:
之前,我能够在 Visual Studio 2013 下运行特定项目的单元测试就好了。这最近停止工作没有对项目进行重大更改,不幸的是我不记得它最后一次工作是什么时候,也不记得从那以后发生了什么变化。但是,对项目本身的任何修改都是最小的(一两个新方法),并且不涉及any configuration file changes or similar frequently reported issues。我认为 Visual Studio 的更改(可能是最近的更新)、插件或第三方软件会导致以下问题。
加载项目时,一分钟后输出窗口中的“测试”输出显示:
------ 发现测试开始------
初始化客户端代理失败:无法连接到测试进程 vstest.discoveryengine.x86.exe。
========== 发现测试已完成:找到 0 个 (0:00:59.8853102) ==========
Similar to a previously reported problem where just debugging stopped working,以管理员身份运行 Visual Studio 似乎“解决”了这个问题。然而,这只是表明问题可能与访问权限有关。
我找到了a related Microsoft Connect bug report,这也暗示问题是由第三方应用程序引起的。显然vstest.discoveryengine.x86.exe 使用命名管道与devenv.exe 通信。另一个应用程序可能会使用该请求,从而导致 Visual Studio 连接失败。但是,verifying which named pipes were in use,我没有发现任何明显的罪魁祸首。我还认为连接可能由于其他原因而失败。
After enabling logging fordevenv.exe、vstest.executionengine.exe和vstest.discoveryengine.exe我在devenv日志中发现了以下与发现引擎相关的异常:
E, 10048, 42, 2014/12/22, 01:47:13.683, 63637924754, devenv.exe, TestRunnerServiceClient: Could not connect to test runner service within the available time 60000. Reason:System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at net.pipe://steven-flip/vstest.discoveryengine/8232 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Server stack trace:
at System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
...
... 以及稍后,vstest.executionengine.exe 的类似例外
E, 10048, 40, 2014/12/22, 01:47:15.600, 63642778910, devenv.exe, TestRunnerServiceClient: Could not connect to test runner service within the available time 60000. Reason:System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at net.pipe://steven-flip/vstest.discoveryengine/9884 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Server stack trace:
at System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
执行引擎似乎正确启动并等待传入请求。最后一个条目是:TestExecutorService: Created/Started the listening channel. ChannelUri=net.pipe://steven-flip/TestExecutor/4912。
发现引擎也是如此,最后一行是:I, 8232, 1, 2014/12/22, 01:46:13.942, 63486587413, vstest.discoveryengine.exe, ServiceMain: Started the service host 8232
有没有人遇到过类似的问题?如何最好地解决这个问题?我不认为以管理员身份持续运行 Visual Studio 是一个合适的解决方案。
【问题讨论】:
-
您能找到合适的解决方案吗?我遇到了同样的问题。 (就我而言,我使用的是命令行工具 vstest.console.exe,并且我已经以管理员身份运行它)
-
@Turbo Nope,但尚未尝试新设置(Windows 10,新 VS)。
-
@Turbo,你解决过这个问题吗?我现在被屏蔽了。
-
当我的 vstest 项目已经在运行时,我突然遇到了这个问题。我删除了测试项目并重新添加它,但是 SLN 文件不让我,所以我删除并重新制作了 SLN 文件,重新添加了项目,一切都很好。奇怪...
-
这仍然在 Visual Studio 2017 中随机发生,没有任何提示说明为什么会发生。
标签: visual-studio mstest