Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging C# code in Visual Studio Code on Windows

How do you debug C# in Visual Studio Code on Windows?

I have an aspnet core project set up, I can build and edit it in VS Code and it works great.

I've installed the C# Omnisharp extension as per all of the getting started guides show and it's really easy to get going, except for one hugely important thing...

How do you actually debug it on Windows? Every article / blog post that I've come across only shows C# debugging with OSX or Linux.

Debugging with Mono doesn't work, I get the following:

Mono Debug is not supported on this platform (Win32NT).

And you can't install the Mono-Debugger extension on Windows - only OSX and Linux. Which makes sense, but what are the steps to do this with Windows?

I must be missing something really easy - how do I set up C# debugging with Visual Studio Code on Windows?

like image 225
Alex Avatar asked Nov 08 '22 15:11

Alex


1 Answers

I've stumbled upon it myself and found the answer in instalation guide of debugger:

https://marketplace.visualstudio.com/items?itemName=Unity.unity-debug

You should check whether you have launch.json file already. If so, delete it and after clicking a cogwheel on top of debug view, select Unity Editor from dropdown.

There is also a VSCode Unity plugin, which may overwrite the file every time you start the game in the editor. To disable this uncheck the "Edit/Preferences/VSCode/Always Write Launch File" checkbox

like image 72
Karol Stola Avatar answered Nov 14 '22 22:11

Karol Stola