# C# .NET Unit Test Debugging?

**URL:** <https://forum.cursor.com/t/c-net-unit-test-debugging/41095>\
**Category:** Help\
**Created:** [January 13, 2025, 2:31pm UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095 "2025-01-13T14:31:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ductoman16](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ductoman16/32/19854_2.png) [@ductoman16](https://forum.cursor.com/u/ductoman16)\
**Post date:** [January 13, 2025, 2:31pm UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/1 "2025-01-13T14:31:01Z")

</div>

I **am** able to debug my application using Samsung’s `netcoredbg` (following the instructions in [GitHub - dgokcin/dotnet-cursor-debugging-with-breakpoints](https://github.com/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`.

> “.NET Debugging is supported only in Microsoft versions of VS Code. See [Microsoft .NET Core Debugger licensing and Microsoft Visual Studio Code · dotnet/vscode-csharp Wiki · GitHub](https://aka.ms/VSCode-DotNet-DbgLicense) for more information.”

Does anyone know how to do this, or have a workaround that doesn’t involve switching between Cursor and VSCode/VisualStudio?

 ![Screenshot 2025-01-13 at 9.22.18 AM](https://us1.discourse-cdn.com/cursor1/original/3X/d/d/dd7c4c131a09bb818ada762ac63c3c20977d1163.png)

---

<div class="post-metadata">

**Author:** ![ViezeVingertjes](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/viezevingertjes/32/18540_2.png) [@ViezeVingertjes](https://forum.cursor.com/u/ViezeVingertjes)\
**Post date:** [January 13, 2025, 9:39pm UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/2 "2025-01-13T21:39:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pshenichnov](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/pshenichnov/32/31533_2.png) [@pshenichnov](https://forum.cursor.com/u/pshenichnov)\
**Post date:** [February 28, 2025, 12:58am UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/3 "2025-02-28T00:58:14Z")

</div>

Have you figured out how to do this by any chance? 🙂

---

<div class="post-metadata">

**Author:** ![ductoman16](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ductoman16/32/19854_2.png) [@ductoman16](https://forum.cursor.com/u/ductoman16)\
**Post date:** [February 28, 2025, 3:07pm UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/4 "2025-02-28T15:07:50Z")

</div>

No unfortunately… This is still the only reason I still keep VisualStudio/VSCode around instead of using Cursor exclusively.

---

<div class="post-metadata">

**Author:** ![pshenichnov](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/pshenichnov/32/31533_2.png) [@pshenichnov](https://forum.cursor.com/u/pshenichnov)\
**Post date:** [February 28, 2025, 6:04pm UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/5 "2025-02-28T18:04:28Z")

</div>

Thanks for sharing… I’ll stop my attempts to debug tests in Cursor then. Indeed, running several IDEs is annoying.

---

<div class="post-metadata">

**Author:** ![jorgepsmatos](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/jorgepsmatos/32/32946_2.png) [@jorgepsmatos](https://forum.cursor.com/u/jorgepsmatos)\
**Post date:** [March 5, 2025, 12:39am UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/6 "2025-03-05T00:39:56Z")

</div>

I was able to do it but it’s very convoluted, so I’m still trying to find a better way.

Basically follow this guide: [Dotnet debugging with VSCodium on Linux - Some tech notes](https://www.yvesdennels.com/posts/dotnet_debugging_with_vscodium/)

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

```auto
"processId": "${command:pickProcess}",

```

So I have to edit the `processId` manually each time…

Here’s my configuration example

```auto
        {
            "name": ".NET Test Attach (Given ID)",
            "type": "coreclr",
            "request": "attach",
            "processId": "100836",
            "pipeTransport": {
                "debuggerPath": "netcoredbg.exe",
                "windows": {
                    "pipeCwd": "${workspaceFolder}",
                    "pipeProgram": "bash",
                    "pipeArgs": [
                        "-c"
                    ],
                    "debuggerArgs": [
                        "--interpreter=vscode",
                    ],
                    "quoteArgs": true
                },
            }
        },

```

---

<div class="post-metadata">

**Author:** ![ductoman16](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ductoman16/32/19854_2.png) [@ductoman16](https://forum.cursor.com/u/ductoman16)\
**Post date:** [March 5, 2025, 1:42am UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/7 "2025-03-05T01:42:44Z")

</div>

Thank you, that worked!

I was able to get it working on my M2 Mac with my netcoredbg compiled from source (following the [instructions](https://github.com/dgokcin/dotnet-cursor-debugging-with-breakpoints) from my original post), with this configuration:

```json
        {
            "name": ".NET Core Attach (console)",
            "type": "coreclr",
            "processId": "${command:pickProcess}",
            "request": "attach",
            "console": "integratedTerminal",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnSessionStart",
            "pipeTransport": {
                "pipeCwd": "${workspaceFolder}",
                "pipeProgram": "bash",
                "pipeArgs": ["-c"],
                "debuggerPath": "/Users/yourUsername/.local/netcoredbg",
                "quoteArgs": true
            }
        }

```

The `command:pickProcess` seems to work, so I can just choose the process from the list after running the test with `VSTEST_HOST_DEBUG` set to `1`!

Obviously not ideal, but this will work for now!

---

<div class="post-metadata">

**Author:** ![ductoman16](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ductoman16/32/19854_2.png) [@ductoman16](https://forum.cursor.com/u/ductoman16)\
**Post date:** [March 5, 2025, 1:57am UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/8 "2025-03-05T01:57:50Z")

</div>

One additional note:

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.

---

<div class="post-metadata">

**Author:** ![jorgepsmatos](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/jorgepsmatos/32/32946_2.png) [@jorgepsmatos](https://forum.cursor.com/u/jorgepsmatos)\
**Post date:** [March 6, 2025, 11:40pm UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/9 "2025-03-06T23:40:57Z")

</div>

Ok, that’s interesting, the pickProcess might just be broken on Windows

The error I got on windows is:

“stderr: your 131072x1 screen size is bogus. expect trouble  
your 131072x1 screen size is bogus. expect trouble”

---

<div class="post-metadata">

**Author:** ![jorgepsmatos](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/jorgepsmatos/32/32946_2.png) [@jorgepsmatos](https://forum.cursor.com/u/jorgepsmatos)\
**Post date:** [March 8, 2025, 2:34am UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/10 "2025-03-08T02:34:02Z")

</div>

Ok, I got some news. I found this extension that has not received updates for some time now but does work on VS Code (apart from a few bugs): [GitHub - formulahendry/vscode-dotnet-test-explorer: .NET Core Test Explorer for Visual Studio Code](https://github.com/formulahendry/vscode-dotnet-test-explorer)

But looking at the code got me intrigued, and I decided to fork it and try to add the support for the pipeTransport and I got it working:

 ![image](https://us1.discourse-cdn.com/cursor1/original/3X/0/7/073baf923f0537c5d83bec74e9b143488c48fb08.png)

For anyone interested, here is the packaged extension with my changes (check what I changed in the commit history): [Release Pre-Release 0.7.9 · jorgepsmatos/vscode-dotnet-test-explorer · GitHub](https://github.com/jorgepsmatos/vscode-dotnet-test-explorer/releases/tag/0.7.9)

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [June 18, 2026, 10:32am UTC](https://forum.cursor.com/t/c-net-unit-test-debugging/41095/11 "2026-06-18T10:32:15Z")

</div>

Closed on June 18, 2026, 10:32am UTC


