fsprojects / fsharp-language-server

Other
218 stars 37 forks source link

Debugging xUnit / NUnit tests hangs at "Host debugging is enabled. Please attach debugger to testhost process to continue." #85

Closed ChristophSchmidpeter closed 3 years ago

ChristophSchmidpeter commented 3 years ago

Running xUnit / NUnit tests hangs after the console output: Host debugging is enabled. Please attach debugger to testhost process to continue.

In #46 @georgewfraser recommends pressing a play button:

Also, the debugger starts paused for some complicated reason that I forget. So you may just need to press play...it would be nice if that were not necessary, obviously.

I assue the button on the very left toolbar was meant. However, that doesn't seem to help. How can I get the unit thest to be debugged?

baronfel commented 3 years ago

Here is a slightly more detailed tutorial.

The gist is that to debug tests that are run through dotnet test, there are actually two processes involved:

When you use the VS Code debugger to attach to the second of these, the first process is paused and waiting for execution to resume, so you must use the 'debugging resume' button, which looks like a 'play' symbol, from the debugging toolbar to continue execution. The final screenshot in this tutorial shows the toolbar I speak of in the top-right hand side of the image.

ChristophSchmidpeter commented 3 years ago

@baronfel Thanks for the amazingly fast response and the detailed description and link to the tutorial. Now I have got it working.

ChristophSchmidpeter commented 3 years ago

Is there already a feature request to have the plugin automatically attach the debugger to the testhost process, or is there any technical impediment that prevents implementing this?

Edit: I have created a respective feature request.