I am having trouble running tests from inside VS. I created the simplest solution with just one NUnit Test project from the template and one test with Assert.IsTrue(true).
Here are the NuGet packages I added to the project with their versions in case it helps:
Here is the output I get when running the tests from the command line using dotnet test [projName]:
Determining projects to restore...
Restored /Users/OpenMinder/DevTraining/Test/Test.csproj (in 331 ms).
Test -> /Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.dll
Test run for /Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.dll (.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.8.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 29 ms - /Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.dll (netcoreapp3.1)
But whenever I try to run them from VS for mac I get the following behaviour:
The tests names don't show up in the panel
The test run doesn't finish
I get the following error in the output:
Failed to launch testhost with error: System.AggregateException: One or more errors occurred. (ApplicationName='/usr/local/bin/dotnet', CommandLine='exec --runtimeconfig "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.runtimeconfig.json" --depsfile "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.deps.json" "/Users/OpenMinder/.nuget/packages/microsoft.testplatform.testhost/16.8.0/lib/netcoreapp2.1/testhost.dll" --port 56039 --endpoint 127.0.0.1:056039 --role client --parentprocessid 8638 --telemetryoptedin false', CurrentDirectory='/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1', Native error= Cannot find the specified file) ---> System.ComponentModel.Win32Exception: ApplicationName='/usr/local/bin/dotnet', CommandLine='exec --runtimeconfig "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.runtimeconfig.json" --depsfile "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.deps.json" "/Users/OpenMinder/.nuget/packages/microsoft.testplatform.testhost/16.8.0/lib/netcoreapp2.1/testhost.dll" --port 56039 --endpoint 127.0.0.1:056039 --role client --parentprocessid 8638 --telemetryoptedin false', CurrentDirectory='/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1', Native error= Cannot find the specified file
at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/System/System.Diagnostics/Process.cs:778
at System.Diagnostics.Process.Start () [0x0003a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs:2006
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess (System.String processPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.IDictionary`2[TKey,TValue] envVariables, System.Action`2[T1,T2] errorCallback, System.Action`1[T] exitCallBack) [0x00101] in <06d9ef76610d4473ae17230fef5fa07d>:0
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.LaunchHost (Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessStartInfo testHostStartInfo, System.Threading.CancellationToken cancellationToken) [0x0006d] in <8b213d9f519447a3ad29e7a4013d8bc9>:0
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager+<>c__DisplayClass34_0.<LaunchTestHostAsync>b__0 () [0x00000] in <8b213d9f519447a3ad29e7a4013d8bc9>:0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:534
at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.LaunchTestHostAsync (Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessStartInfo testHostStartInfo, System.Threading.CancellationToken cancellationToken) [0x00096] in <8b213d9f519447a3ad29e7a4013d8bc9>:0
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00013] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2029
at System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:496
at System.Threading.Tasks.Task`1[TResult].get_Result () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:466
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel (System.Collections.Generic.IEnumerable`1[T] sources) [0x00115] in <c4016cc04b6c4d6fb0610501f99366ce>:0
---> (Inner Exception #0) System.ComponentModel.Win32Exception (0x80004005): ApplicationName='/usr/local/bin/dotnet', CommandLine='exec --runtimeconfig "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.runtimeconfig.json" --depsfile "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.deps.json" "/Users/OpenMinder/.nuget/packages/microsoft.testplatform.testhost/16.8.0/lib/netcoreapp2.1/testhost.dll" --port 56039 --endpoint 127.0.0.1:056039 --role client --parentprocessid 8638 --telemetryoptedin false', CurrentDirectory='/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1', Native error= Cannot find the specified file
at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/System/System.Diagnostics/Process.cs:778
at System.Diagnostics.Process.Start () [0x0003a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs:2006
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess (System.String processPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.IDictionary`2[TKey,TValue] envVariables, System.Action`2[T1,T2] errorCallback, System.Action`1[T] exitCallBack) [0x00101] in <06d9ef76610d4473ae17230fef5fa07d>:0
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.LaunchHost (Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessStartInfo testHostStartInfo, System.Threading.CancellationToken cancellationToken) [0x0006d] in <8b213d9f519447a3ad29e7a4013d8bc9>:0
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager+<>c__DisplayClass34_0.<LaunchTestHostAsync>b__0 () [0x00000] in <8b213d9f519447a3ad29e7a4013d8bc9>:0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:534
at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.LaunchTestHostAsync (Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessStartInfo testHostStartInfo, System.Threading.CancellationToken cancellationToken) [0x00096] in <8b213d9f519447a3ad29e7a4013d8bc9>:0 <---
Failed to launch testhost with error: System.AggregateException: One or more errors occurred. (ApplicationName='/usr/local/bin/dotnet', CommandLine='exec --runtimeconfig "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.runtimeconfig.json" --depsfile "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.deps.json" "/Users/OpenMinder/.nuget/packages/microsoft.testplatform.testhost/16.8.0/lib/netcoreapp2.1/testhost.dll" --port 56039 --endpoint 127.0.0.1:056039 --role client --parentprocessid 8638 --telemetryoptedin false', CurrentDirectory='/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1', Native error= Cannot find the specified file) ---> System.ComponentModel.Win32Exception: ApplicationName='/usr/local/bin/dotnet', CommandLine='exec --runtimeconfig "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.runtimeconfig.json" --depsfile "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.deps.json" "/Users/OpenMinder/.nuget/packages/microsoft.testplatform.testhost/16.8.0/lib/netcoreapp2.1/testhost.dll" --port 56039 --endpoint 127.0.0.1:056039 --role client --parentprocessid 8638 --telemetryoptedin false', CurrentDirectory='/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1', Native error= Cannot find the specified file
at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/System/System.Diagnostics/Process.cs:778
at System.Diagnostics.Process.Start () [0x0003a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs:2006
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess (System.String processPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.IDictionary`2[TKey,TValue] envVariables, System.Action`2[T1,T2] errorCallback, System.Action`1[T] exitCallBack) [0x00101] in <06d9ef76610d4473ae17230fef5fa07d>:0
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.LaunchHost (Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessStartInfo testHostStartInfo, System.Threading.CancellationToken cancellationToken) [0x0006d] in <8b213d9f519447a3ad29e7a4013d8bc9>:0
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager+<>c__DisplayClass34_0.<LaunchTestHostAsync>b__0 () [0x00000] in <8b213d9f519447a3ad29e7a4013d8bc9>:0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:534
at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.LaunchTestHostAsync (Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessStartInfo testHostStartInfo, System.Threading.CancellationToken cancellationToken) [0x00096] in <8b213d9f519447a3ad29e7a4013d8bc9>:0
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00013] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2029
at System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:496
at System.Threading.Tasks.Task`1[TResult].get_Result () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:466
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel (System.Collections.Generic.IEnumerable`1[T] sources) [0x00115] in <c4016cc04b6c4d6fb0610501f99366ce>:0
---> (Inner Exception #0) System.ComponentModel.Win32Exception (0x80004005): ApplicationName='/usr/local/bin/dotnet', CommandLine='exec --runtimeconfig "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.runtimeconfig.json" --depsfile "/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1/Test.deps.json" "/Users/OpenMinder/.nuget/packages/microsoft.testplatform.testhost/16.8.0/lib/netcoreapp2.1/testhost.dll" --port 56039 --endpoint 127.0.0.1:056039 --role client --parentprocessid 8638 --telemetryoptedin false', CurrentDirectory='/Users/OpenMinder/DevTraining/Test/bin/Debug/netcoreapp3.1', Native error= Cannot find the specified file
at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/System/System.Diagnostics/Process.cs:778
at System.Diagnostics.Process.Start () [0x0003a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs:2006
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess (System.String processPath, System.String arguments, System.String workingDirectory, System.Collections.Generic.IDictionary`2[TKey,TValue] envVariables, System.Action`2[T1,T2] errorCallback, System.Action`1[T] exitCallBack) [0x00101] in <06d9ef76610d4473ae17230fef5fa07d>:0
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.LaunchHost (Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessStartInfo testHostStartInfo, System.Threading.CancellationToken cancellationToken) [0x0006d] in <8b213d9f519447a3ad29e7a4013d8bc9>:0
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager+<>c__DisplayClass34_0.<LaunchTestHostAsync>b__0 () [0x00000] in <8b213d9f519447a3ad29e7a4013d8bc9>:0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:534
at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.LaunchTestHostAsync (Microsoft.VisualStudio.TestPlatform.ObjectModel.TestProcessStartInfo testHostStartInfo, System.Threading.CancellationToken cancellationToken) [0x00096] in <8b213d9f519447a3ad29e7a4013d8bc9>:0 <---
VS version 8.8 build 2913
macOS Catalina 10.15.7
My current dotnet info:
.NET SDK (reflecting any global.json):
Version: 5.0.100
Commit: 5044b93829
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/5.0.100/
Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7
.NET SDKs installed:
3.1.404 [/usr/local/share/dotnet/sdk]
5.0.100 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Anybody has any idea of what else I can try?
Let me know if you need any more information.
Maybe this helps someone, I managed to solve this now, I created a symbolic link in the past to fix something else and I forgot about that.
I fixed this by removing that link with this command:
rm /usr/local/bin/dotnet
Now I am able to use both VS Code and VS for Mac.
Thanks!
User contributions licensed under CC BY-SA 3.0