Manuel Moser
Manuel Moser

Reputation: 770

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

Upvotes: 19

Views: 66020

Answers (6)

GebaiPerson
GebaiPerson

Reputation: 71

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

Upvotes: 0

Requin
Requin

Reputation: 577

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

Upvotes: 0

Marco Graziano
Marco Graziano

Reputation: 476

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

Upvotes: 8

Ashlesha Waikos
Ashlesha Waikos

Reputation: 47

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

Upvotes: 1

Pedram A. Keyvani
Pedram A. Keyvani

Reputation: 812

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

Upvotes: 2

PrathapG
PrathapG

Reputation: 789

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

Upvotes: 1

Related Questions