11

I'm trying to debug a C# script using VSCode. but when I hit F5 it shows

Error message while trying to debug

But I do have the C# extension installed in VSCode

C# Extension on Marketplace

About my VSCode

Version: 1.56.2 (system setup)
Commit: 054a9295330880ed74ceaedda236253b4f39a335
Date: 2021-05-12T17:13:13.157Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.19042

I also have Dotnet installed on my machine

dotnet --version
5.0.203

Previously, VSCode used to resolve all the necessary dependencies and create the necessary files for debugging a C# script. Maybe the latest update has some issues?

Vishnu
  • 1,757
  • 2
  • 11
  • 19
  • When debugging you reference the Debug Folder when file was built (not release). The debug folder has a pdb file which contains the symbolic info that is used for debugging. – jdweng May 25 '21 at 12:49

2 Answers2

4

If you have issues with that I suggest going to 'view' and then press command pallet or press Ctrl+Shift+P and then search 'generate assets for build and debug' and if you want it to open up a new window and execute your code instead of it running in the terminal: Go open .vscode Then select launch.json and then go to where it says console and write this instead:

"console": "externalTerminal",
Techy Shadow
  • 354
  • 3
  • 13
0

Is there a .vscode folder in the folder you are working out of or in a parent folder? Not having that will cause issues with VS-Code loading extensions.

Did you open VS-code by clicking on a source code file in File Explorer? If so then VS-Code is currently unaware of your .vscode folder for that project.

Either way the solution is to open the folder through VS-Code by going to File->Open Folder and select the folder your project is in. In the former case you will also get a message asking you if you want to generate something and you need to click yes on that. This also seems to solve some instances of getting the 'Unable to generate assets' and 'Omnisharp server is not running' errors.

Izzy
  • 35
  • 1
  • 5