I am able to debug my application using Samsung’s netcoredbg (following the instructions in GitHub - dgokcin/dotnet-cursor-debugging-with-breakpoints), but I haven’t been able to figure out how to debug unit tests in this same way.
Ideally I’d like to just be able to Right Click > Debug Test in the Test Explorer, but I haven’t been able to figure out how to configure the Test Explorer to use netcoredbg instead of Microsoft’s debugger. It just shows the same error message that I got before switching my application launch to use netcoredbg.
Could not get it to work, but i have rider open simultaneously most of the time which is pretty light compared to VS. For just building or running tests, dotnet run and dotnet test do great though.
Debugging would be great if possible, but would prefer official tooling in that case.
You basically launch the test with VSTEST_HOST_DEBUG set to 1 which makes the test wait for a debugger to attach to execute and then launch the given configuration.
But the configuration as proposed gave me errors and was only able to make it work with
"processId": "${command:pickProcess}",
So I have to edit the processId manually each time…
I was able to get it working on my M2 Mac with my netcoredbg compiled from source (following the instructions from my original post), with this configuration:
When you have multiple test projects (I have 4 in my current codebase), dotnet test will spawn an instance of testhost.dll for each project, and wait for each of them to be attached to individually before the command will complete.