Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code debugger doesn't stop at breakpoints

https://github.com/discord-bot-tutorial/Community-Discord-BOT The c# debugger for vscode doesn't stop at breakpoints with this specific project. I have tried creating a new project with dotnet new console dotnet restore
which worked correctly and I tried it with another project I created in Visual Studio Community 2017 which worked exactly as it should too.

launch.json and tasks.json https://gist.github.com/M4N1/daff738de1d5cbcf8cf3fdc461c3a83c

Update

I just tried the same thing on Ubuntu 18.04 (instead of win10) where it worked perfectly fine with the same version of vscode (1.28.1).

like image 584
Manuel Moser Avatar asked Oct 15 '18 05:10

Manuel Moser


People also ask

Why breakpoint is not hitting with VS code?

If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.

Why is Eclipse not stopping at breakpoints?

The solution was to enable it again, start a debug session, the breakpoint is hit and shown in the UI, then disable again the option. There is also another simpler way that will make Eclipse show the debugging highlight at the breakpoint or rather refresh the debugging UI to work as it should.

What happens when a breakpoint is reached when the debugger is enabled?

If a breakpoint is reached, or a signal not related to stepping occurs before count steps, stepping stops right away. Continue to the next source line in the current (innermost) stack frame. This is similar to step , but function calls that appear within the line of code are executed without stopping.


3 Answers

If you have upgraded your .Net Core SDK recently, just update netcoreappX.X

 "program": "${workspaceFolder}/CommunityBot/bin/Debug/netcoreappX.X/CommunityBot.dll"

in launch.json file. Check your .Net Core SDK version by dotnet --version

like image 85
Pedram A. Keyvani Avatar answered Oct 22 '22 15:10

Pedram A. Keyvani


I use this configuration and work only if I insert this two line

// "stopOnEntry": true
// "justMyCode": false

{
  "version": "0.2.0",
  "configurations": [
    {
        "name": "Python: Debug Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal",
        "stopOnEntry": true,
        "justMyCode": false
    },
  ]
}
like image 31
Marco Graziano Avatar answered Oct 22 '22 15:10

Marco Graziano


In VSCode 1.20 and 1.21 does not allow you to hit breakpoints. VSCode 1.18 works fine

If you are using VSCode 1.21 set the outFiles parameter in your launch config

Workaround - Try Deactivate then reactive breakpoints after debugging has started, Or, right click the breakpoints pane and "Reapply all breakpoints".

like image 1
PrathapG Avatar answered Oct 22 '22 17:10

PrathapG