microsoft / vscode-mono-debug

A simple VS Code debug adapter for mono
Other
159 stars 172 forks source link

Can you attach to NUnit tests running VS Code C# DevKit? #96

Open DigitalFlow opened 5 months ago

DigitalFlow commented 5 months ago

Hi there,

we installed this extension and want to test .net 4.6.2 (full framework) assemblies in VS Code (on Linux) using the C# DevKit extension.

Executing tests works using mono.

But when trying to debug our unit tests they never reach a break point, although our projects all have full configured. The debugger always shows "No symbols have been loaded for this document.".

Adding a launch.json with value

{ "version": "0.2.0", "configurations": [ { "name": "Attach to Mono", "request": "attach", "type": "mono", "address": "localhost", "port": 55555 } ] }

did not change this behaviour.

Is it possible to get vscode-momo-debug play with C# Dev Kit?

Kind regards, Florian

DigitalFlow commented 5 months ago

I at least came as far as downloading a nunit-console build that works for .net-4.6.2 in linux and running it like this:

mono --debug --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:55555 ../NUnit.Console-3.16.0/bin/nunit3-console.exe bin/Debug/net462/SomeProject.Tests.dll

The above command starts mono and seems to wait for a debugger to attach.

With the launch.json from the initial post I'm able to attach from the VS Code debugger view, but no break point will be hit, the console runner just runs the tests (which pass) and exit.

Of course I compiled everything in Debug mode.

akoeplinger commented 1 month ago

The commands look good to me, the only thing I could imagine is that you're not using portable PDB files. Mono can't read the Windows-only "full" PDB files so make sure your project has <DebugType>Portable</DebugType>.