How to disable "just my code" setting in VSCode debugger?
When starting my project in the debugger (C# .NET Core), it states it's debugging "just my code".
I want to also debug the libraries, and can't see a setting to disable this anywhere in VSCode.
Is it possible to disable?
For this you need to change the launch.json
file. Inside the launch.json
file you have to set "justMyCode"
to false
.
As described here. (I was pointed to that link through this post on the Visual Studio Code site.)
Just adding "justMyCode": false
to launch.json
doesn't work. You need to add a separate config in launch.json
like below. FYI each {}
represents a config.
"configurations": [
{
.... # existing config
},
{
"name": "Debug Unit Test",
"type": "python",
"request": "test",
"justMyCode": false,
}
]
As pointed out in here
If you're specifically debugging Python unit tests, adding "justMyCode": "false"
to your normal config won't do, you'll need to add another in your launch.json with "request": "test"
:
{
"name": "Debug Unit Test",
"type": "python",
"request": "test",
"justMyCode": false,
},
Source: Github Microsoft/vscode-python Issue #7131
VSCode 1.60 was complaining about the "request": "test"
method suggested by others.
But I did have to add a new section below my existing configuration to get "justMyCode": false
to work.
Here is what worked for me:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": [
"blah",
"whatever"
]
},
{
"name": "Python: Debug Unit Tests",
"type": "python",
"request": "launch",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false,
}
]
}
The purpose addition appears to be important.
I found the correct approach documented here: https://code.visualstudio.com/docs/python/testing#_debug-tests
In the documenentation of Visual Studio Code they have a section "Skipping uninteresting code".
VS Code Node.js debugging has a feature to avoid source code that you don't want to step through (AKA 'Just My Code').
This feature can be enabled with the skipFiles attribute in your launch configuration. skipFiles is an array of glob patterns for script paths to skip.
In your launch.json file you have to add (or any other file you want to skip):
"skipFiles": [
"${workspaceFolder}/node_modules/**/*.js",
"${workspaceFolder}/lib/**/*.js"
]