Before, I was able to run the unit tests of a particular project under Visual Studio 2013 just fine. This has recently stopped working without major changes to the project, and unfortunately I do not recall when it did last work, nor what changed since. However, any modifications to the project itself were minimal (one or two new methods), and did not involve any configuration file changes or similar frequently reported issues. I believe rather that a change in Visual Studio (perhaps a recent update), or plug-ins or third party software is causing the following issue.
While loading the project, after one minute the "Tests" output in the Output Window shows:
------ Discover test started ------
Failed to initialize client proxy: could not connect to test process vstest.discoveryengine.x86.exe.
========== Discover test finished: 0 found (0:00:59.8853102) ==========
Similar to a previously reported problem where just debugging stopped working, running Visual Studio as administrator seems to 'resolve' the issue. However this is simply an indication the problem might have got something to do with access rights.
I found a related Microsoft Connect bug report, which also hints at the problem being caused by a third party application. Apparently vstest.discoveryengine.x86.exe
uses named pipes to communicate with devenv.exe
. Another application could consume the request, thus resulting in a failed connection for Visual Studio. However, verifying which named pipes were in use, I did not find any immediately obvious culprits. I also imagine the connection might fail for other reasons.
After enabling logging for devenv.exe
, vstest.executionengine.exe
and vstest.discoveryengine.exe
I found the following exceptions related to the discovery engine in the devenv log:
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)
...
... and later on, a similar exception for 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)
The execution engine seems to start correctly and waits for incoming requests. The last entry is: TestExecutorService: Created/Started the listening channel. ChannelUri=net.pipe://steven-flip/TestExecutor/4912
.
Same goes for the discovery engine of which the last line is: I, 8232, 1, 2014/12/22, 01:46:13.942, 63486587413, vstest.discoveryengine.exe, ServiceMain: Started the service host 8232
Did anyone encounter similar problems? How to best tackle this? I do not find constantly running Visual Studio as administrator to be a suitable solution.