Unexpected error detected check the tests output pane for details

When I build any project in my solution, message "Unexpected error detected. Check the Tests Output Pane for details." appear on bottom on vs window. The test explorer window is empty (no tests, although later all works).
  • Remove From My Forums
  • Question

  • When I build any project in my solution, message «Unexpected error detected. Check the Tests Output Pane for details.» appear on bottom on vs window. The test explorer window is empty (no tests, although later all works).

    In output window, for show output from : Tests  — this error

    System.ArgumentNullException: Value cannot be null.
    Parameter name: source  
     at Microsoft.VisualStudio.Shell.ValidateArg.NotNull[T](T arg, String parameterName)
       at Microsoft.VisualStudio.Shell.ValidateArg.NotNullOrEmpty[T](IEnumerable`1 arg, String parameterName)
       at Microsoft.VisualStudio.Shell.Interop.VSProjectExtensions.CompareNormalizedPath(String source, String target)
       at Microsoft.VisualStudio.Shell.Interop.VSProjectExtensions.GetKeyOutputForIVsOutputGroup(IVsOutputGroup outputGroup)
       at Microsoft.VisualStudio.Shell.Interop.VSProjectExtensions.GetProjectOutputPath(IVsProjectCfg2 projectConfig, String groupName)
       at Microsoft.VisualStudio.Shell.Interop.VSProjectExtensions.GetKeyOutputForGroup(IVsSolutionBuildManager buildManager, IVsProject project, String groupName)
       at Microsoft.VisualStudio.Shell.Interop.VSProjectExtensions.GetProjectOutputPath(IVsProject project, IServiceProvider serviceProvider)
       at Microsoft.VisualStudio.TestWindow.VsAdapters.VsTestContainer.get_Source()
       at Microsoft.VisualStudio.TestWindow.VsAdapters.VsTestContainer.CreateTimeStamp()
       at Microsoft.VisualStudio.TestWindow.VsAdapters.VsTestContainer..ctor(ITestContainerDiscoverer discoverer, ILogger log, IVsProject project, IServiceProvider serviceProvider,
    IVsAppContainerUtilities appContainerUtilities)

       at Microsoft.VisualStudio.TestWindow.VsAdapters.VsProjectOutputContainerDiscoverer.<get_TestContainers>b__0(IVsProject p)
       at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at Microsoft.VisualStudio.TestWindow.Controller.TestContainerDiscovererExtension.GetSortedContainers(ITestContainerDiscoverer discoverer)
       at Microsoft.VisualStudio.TestWindow.Controller.TestContainerProvider.GetContainersFromDiscoverer(ITestContainerDiscoverer discoverer)

    Any suggests? thanks.

Answers

  • Hello,

    Thank you for your post.

    Just to make the issue clear, what version of VS2012 do you work with? What type of test are you doing?

    Do you get this issue during building the test project?

    I suggest that you can try to recreate a new unit test project including a simple unit test and then build the test project to check if the issue still occurs.

    If yes, I am afraid that the issue is related to your VS.
    You could locate to the IDE folder then run these commands to check if it can help
    .

    Please open Windows Explorer, and navigate to <Visual Studio Installation Path>Common7IDE:

    Devenv.exe /SafeMode: Launches the IDE in safe mode loading minimal windows.

    Devenv.exe /ResetSettings: Restores the IDE’s default settings, optionally resets to the specified VSSettings file.

    Devenv.exe /ResetAddin: Removes commands and command UI associated with the specified Add-in.

    Devenv.exe /ResetSkipPkgs: Clears all SkipLoading tags added to VSPackages.

    If still no help, please try to repair/reinstall VS to check the result.

    Also I did some research and find some links with the similar issue.

    http://stackoverflow.com/questions/10159828/vs-11-beta-cannot-start-process-because-a-file-name-has-not-been-provided

    If you get this issue after you upgrade VS from developer preview build to VS11 beta, in this case please refer to the following thread to check if it is useful:

    http://social.msdn.microsoft.com/Forums/en-US/vstest/thread/4035d43f-8581-4c76-9fd1-18b90df7035e

    You can update the results after trying my suggestions above.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by

      Tuesday, April 2, 2013 8:25 AM

Introduction

I was upgrading the .NET Core 3.1 project to .NET 6 and faced issues running test cases in my test projects. I had several projects and test projects for each project; all were working fine after the upgrade. However, I got an issue with only two test projects after the upgrade. So here in this article, I am going to share the issue and the solution to how I fixed it.

Even though there was no single error after the upgrade, the solution was cleaned and built successfully I was not able to run unit tests of two projects.

Once, the upgrade is completed I was testing the solution where I got an error: “unexpected error detected. Check the Tests output Pane for details.”

Two of my test projects didn’t run the test cases, it was about to start and took some time to run the test but got stopped after a few minutes. This is the scenario of the Test project using xunit framework for unit tests.

The below image shows the error that I got while testing.

When I checked the Output pane the exact error was

“Starting test discovery for requested test run

========== Starting test discovery ==========

Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Failed to negotiate protocol, waiting for response timed out after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout.

at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TestRequestSender.CheckVersionWithTestHost()

at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, String runSettings)

at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler)

========== Test discovery aborted: 0 Tests found in 1.5 min ==========

========== Starting test run ==========

Failed to negotiate protocol, waiting for response timed out after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout.

Failed to negotiate protocol, waiting for response timed out after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout.

========== Test run aborted: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in < 1 ms ==========”

Solution

Then I researched, spent several hours surfing various sites, forums and couldn’t get the solution for this. Later on, I checked and compared the project file of working test project after upgrade to .NET 6 and the project having issue after upgrade where I found some differences in the .csproj file.

Differences are listed below:

  1. Additionally, there was no Microsoft.NET.Test.Sdk in the .csproj file.
  2. Project which is having issue has different version of xunit and xunit.runner.visualstudio than the working project.

I updated the project file (csproj) manually and made it same as a working project, then cleaned and built the project. After that the test project worked perfectly.

Updated part of the project.csproj file is highlighted below.

Alternatively, you can add “Microsoft.NET.Test.Sdk” from the NuGet package manager or Package Manager console as well. I made changes to xunit and xunit.runner.visualstudio to make uniformity of version with all test projects.

Note that: some cases only adding the below line in ItemGroup may resolve the issue. In my case only adding the below package reference resolved the problem. However, to maintain the same version of xunit and xunit.runner.visualstudio, I kept the same version of those across all test projects.

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />

Test Project’s project file(.csproj file) in details

  • TargetFramework specifies the target framework of your project.
  • IsPackable has nothing to do. Unit test projects cannot be packed so it is redundant. If you wish you can remove it. However, when you create the test projects in .Net 6, it comes by default.
  • Packages xunit.runner.visualstudio and Microsoft.NET.Test.Sdk are mandatory to run the test project using visual studio as well as with command dotnet test.

In my case, Microsoft.NET.Test.Sdk was missing which plays a vital role to run the unit test that’s why I was not able to run tests.

I hope, this helps you to upgrade your test project to .NET 6 and resolve the issue if you encounter it after the upgrade.

Если я приостановлю Resharper, моя сборка работает. Однако с Resharper я получаю следующее сообщение при сборке.

unexpected error detected. Check the Tests Output Pane for details 

Панель вывода тестов показывает

2/07/2018 10:53:31 AM Informational] ------ Discover test started ------
[2/07/2018 10:53:32 AM Informational] ========== Discover test finished: 18 found (0:00:01.692) ==========
[2/07/2018 10:54:24 AM Error] System.MissingMethodException: Method not found: 'Microsoft.VisualStudio.TestWindow.Extensibility.ITestContainer Microsoft.VisualStudio.TestWindow.Controller.ITestContainerProvider.FindTestContainer(System.String, System.Uri)'.
   at JetBrains.ReSharper.UnitTestProvider.MSTest11.New.JetDiscoveryOperation.<GetTestContainersFor>d__21.MoveNext()
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
   at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
   at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection)
   at System.Linq.EnumerableExJet.ToSet[TSource](IEnumerable`1 source)
   at JetBrains.ReSharper.UnitTestProvider.MSTest11.New.JetDiscoveryOperation.GetTestContainers(IEnumerable`1 sources)
   at JetBrains.ReSharper.UnitTestProvider.MSTest11.New.JetDiscoveryOperation.GeTestContainersAndRetry(IEnumerable`1 sources)
   at JetBrains.ReSharper.UnitTestProvider.MSTest11.New.JetDiscoveryOperation.ExecuteInternalCore()
   at JetBrains.ReSharper.UnitTestProvider.MSTest11.New.JetDiscoveryOperation.<ExecuteInternal>b__6()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.TestWindow.Controller.Operation.<ExecuteWithEvents>d__40.MoveNext()
[2/07/2018 10:54:24 AM Informational] ------ Discover test started ------
[2/07/2018 10:54:25 AM Informational] ========== Discover test finished: 18 found (0:00:00.595) ==========

T

3 ответа

Лучший ответ

Та же проблема была исправлена в сборке ReSharper 2018.1.


2

Alexander Kurakin
11 Июл 2018 в 10:28

Если ваша версия resharper не может обновиться до 2018.1, тогда другой вариант — просто приостановить Resharper, чтобы компиляция прошла успешно. После того, как все построено, вы можете снова включить resharper и без проблем запускать свои модульные тесты.

Вы можете отключить резарпер, зайдя в меню «Инструменты» и выбрав «Параметры». Прокрутите вниз и выберите Resharper -> General. Нажмите кнопку «Приостановить сейчас». Как только сборка завершится успешно, вы можете нажать кнопку «Возобновить».


0

Bill Tarbell
11 Сен 2018 в 14:43

Это случилось со мной в Visual Studio 2017 с Resharper 2019.1.3. Перезапуск Visual Studio решает проблему, так что вы можете по крайней мере продолжить работу.


0

GrayDwarf
12 Авг 2019 в 23:31

iluzek

xunit.runner.visualstudio 2.4.3 — Unexpected error detected. Test run aborted. 0 total tests

With latest version xunit.runner.visualstudio 2.4.3.

Created sample project for .net 5 and corresponding .net core (5.0) class library with tests.
Had to change
net5.0 to net5.0-windows to make it build but it seemed to work after that.

But Visual Studio and Xunit report issues as follow:
Unexpected error detected. Check the Tests Output pane for details.
Test run aborted. 0 total tests — 0 Passed, 0 Failed, 0 Skipped.

I downgraded
xunit.runner.visualstudio 2.4.1 and without doing anything else it worked fine.

Downgrading to 2.4.2 also does NOT work.

nfplee

When I try a build after upgrading to 2.4.3. I get the error:

«Program does not contain a static ‘Main’ method suitable for an entry point»

I’m not sure if this is related but my solution is to also downgrade to 2.4.1.

m4m4m4

I noticed this too in our .Net 3.1 pipelines after having upgraded, 2.4.1 does not have this issue

Visual Studio 2019 Enterprise, 2.4.3 not work too, but I switch to 2.4.1, it work well.

Понравилась статья? Поделить с друзьями:
  • Unexpected indentation как исправить
  • Unexpected error cubase
  • Unexpected indent python ошибка что значит
  • Unexpected indent python ошибка перевод
  • Unexpected error could not estimate gas for the approve