Раньше я мог нормально запускать модульные тесты конкретного проекта в Visual Studio 2013. Недавно это перестало работать без существенных изменений в проекте, и, к сожалению, я не помню, когда он работал в последний раз, и что изменилось с тех пор. Однако любые изменения в самом проекте были минимальными (один или два новых метода) и не включали каких-либо изменений в файле конфигурации или аналогичных часто сообщаемых проблем. Скорее, я полагаю, что изменение в Visual Studio (возможно, недавнее обновление) или в подключаемых модулях или стороннем программном обеспечении вызывает следующую проблему.
При загрузке проекта через минуту вывод "Тесты" в окне вывода показывает:
------ Обнаружение теста началось ------
Не удалось инициализировать клиентский прокси: не удалось подключиться к процессу тестирования vstest.discoveryengine.x86.exe.
========== Обнаружение теста завершено: 0 найдено (0: 00: 59.8853102) ==========
Подобно ранее сообщавшейся проблеме, когда перестала работать только отладка, запуск Visual Studio от имени администратора, похоже, "решил" проблему. Однако это просто признак того, что проблема может иметь отношение к правам доступа.
Я нашел связанный отчет об ошибке Microsoft Connect, который также намекает на проблему, вызванную сторонним приложением. Очевидно, vstest.discoveryengine.x86.exe
использует именованные каналы для связи с devenv.exe
. Другое приложение может потреблять запрос, что приводит к сбою соединения для Visual Studio. Однако, проверяя, какие именованные каналы использовались, я не нашел сразу очевидных виновников. Я также предполагаю, что соединение может прерваться по другим причинам.
После включения ведения журнала для devenv.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
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 администратором подходящим решением.