16

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

10
  • 1
    Running the project in Release Mode? How do the breakpoints appear Solid filled Spheres or Hollow (ouline only) - later would mean dll & pdb/code is out of sync. Commented Oct 15, 2018 at 5:57
  • The sphere is hollow. Commented Oct 15, 2018 at 6:01
  • Mouse hover that Sphere and it will tell you the problem. Your DLL (Binaries) are not in sync with the Source Code/PDB file. Clean-Rebuild the project. Then check the modified datetime of both the dll and corresponding pdb file. Commented Oct 15, 2018 at 6:03
  • 1
    It says "Unverified breakpoint" Commented Oct 15, 2018 at 6:05
  • 1
    In Visual Studio everything is working fine. The problem is Visual Studio Code. Commented Oct 15, 2018 at 6:55

6 Answers 6

8

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
    },
  ]
}
2
  • Those last two lines are super useful 👍 Commented Dec 16, 2021 at 14:07
  • 1
    "justMyCode" is an invalid option. I get a compiler warning with that.
    – Anton
    Commented Jan 12 at 14:37
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".

1
  • 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 Commented Oct 15, 2018 at 8:08
1

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.

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
        }
    ]

Not the answer you're looking for? Browse other questions tagged or ask your own question.