12

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).

Manuel Moser
  • 690
  • 2
  • 6
  • 14

6 Answers6

5

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
    },
  ]
}
LarsTech
  • 80,625
  • 14
  • 153
  • 225
2

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

1

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".

PrathapG
  • 751
  • 1
  • 7
  • 21
  • Didn't work. Additional info: Version: 1.28.1 (system setup) Commit: 3368db6750222d319c851f6d90eb619d886e08f5 Date: 2018-10-11T18:13:53.910Z Electron: 2.0.9 Chrome: 61.0.3163.100 Node.js: 8.9.3 V8: 6.1.534.41 Architecture: x64 – Manuel Moser Oct 15 '18 at 08:08
0

I faced the same issue, I added debug mode to the argument list in the launch.json

  "version": "0.2.0",
  "configurations": [
    {
        "name": ".NET Core Launch (console)",
        "type": "coreclr",
        "request": "launch",
        "preLaunchTask": "build",
        "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/cs-scrapes.dll",


        "args": ["run",
            "debug"

        ],
        "cwd": "${workspaceFolder}",
        "console": "internalConsole",
        "stopAtEntry": false
    },
    {
        "name": ".NET Core Attach",
        "type": "coreclr",
        "request": "attach",
        "processId": "${command:pickProcess}"
    }
]
0

In my case, it helped to start debugging through the toolbar (by clicking) instead of pressing F5.

Requin
  • 467
  • 4
  • 16
0

In my case, there is a warning in debug console saying

To allow this breakpoint to be hit: Add '"requireExactSource": false' to launch.json and restart debugging

And that's what I did. After that, breakpoints were triggered properly. Here's my launch.json:

"configurations": [
        {

            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/###/##.dll",
            "args": [
            ],
            "requireExactSource": false,
            "cwd": "${workspaceFolder}/####",
            "console": "externalTerminal",
            "stopAtEntry": false
        }
    ]