formulahendry / vscode-dotnet-test-explorer

.NET Core Test Explorer for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=formulahendry.dotnet-test-explorer
MIT License
203 stars 97 forks source link

Right-click a test and click debug causes the indicator to spin forever. #357

Open tarekahf opened 2 years ago

tarekahf commented 2 years ago

Steps to reproduce:

  1. Start VS Code
  2. Run the command to create NUnit Test
    dotnet new unit --framwork net5.0
  3. Right-click a test, and click debug.

The wheel will spin forever, and I see the following in the output:

Executing dotnet test --no-build --logger "trx;LogFileName=C:\Users\username\AppData\Local\Temp\2\test-explorer-v2Ocg1\0.trx" --filter "FullyQualifiedName=tests.Tests.Test1" in c:/Projects/Jira/some-folder/tests
Process 48352 started
Waiting for debugger to attach
Waiting for debugger to attach
Waiting for debugger to attach
Waiting for debugger to attach
Waiting for debugger to attach
Waiting for debugger to attach
Waiting for debugger to attach
Waiting for debugger to attach

Required info:

  1. Dotnet sdk version:
    
    > dotnet --info
    .NET SDK (reflecting any global.json):
    Version:   6.0.102
    Commit:    02d5242ed7

Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.102\

Host (useful for support): Version: 6.0.2 Commit: 839cdfb0ec

.NET SDKs installed: 5.0.302 [C:\Program Files\dotnet\sdk] 5.0.405 [C:\Program Files\dotnet\sdk] 6.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]


5. Unit test framework and relevants versions of that: 
"NUnit" Version="3.13.1"
"NUnit3TestAdapter" Version="3.17.0"

6. Dot NET Core Test Explorer Extension: v0.7.7

If I run the tests normally, everything works fine.

Please help to resolve this issue.

Tarek
tarekahf commented 2 years ago

Note that with xUnit it works fine. The debug from the tree works fine without any problem.

PandaWood commented 2 years ago

I notice this debugging feature is in Alpha, according to the "Details" but yeah, debugging never works for me (I'm using NUnit also)

dviererbe commented 1 year ago

I wanted to debug a .NET 7 xUnit Test and I had the same problem. I could attach the debugger manually.

Workaround: On Windows: Search for a process called "testhost.exe" in the TaskManager and use the PID to attach the debugger. After the process stops, the spinning will stop too.

hbertsch commented 1 year ago

Same issue here.

Result:

Executing dotnet build in /Users...
Executing dotnet test --no-build --logger "trx;LogFileName=/var/folders/3c/2fjmjtc575nds0x6l6lxsw_80000gn/T/test-explorer-HeMIaQ/0.trx" --filter "FullyQualifiedName=UnitTests.SerializerTests.ApiToOpbject" in /Users/...
Process 78997 started
Waiting for debugger to attach
Waiting for debugger to attach
Waiting for debugger to attach

Workaround

that worked for me is to start debugging by clicking on Debug Test in the code file view:

debugTest