Search code examples
pythonvisual-studio-codebreakpoints

Visual studio code python break point never works with Attach to Python Functions


Visual studio code python break point never works with "Attach to Python Functions" but works fine with "Python: Current File". I have tried below steps nothing works

  1. Stop VS Code auto update
  2. Install python extension, install another version...
  3. Uninstall/install VS Code..
  4. Uninstall/install extensions..
  5. "justMyCode": false
  6. "justMyCode": true and remove "stopOnEntry": true from launch.json file...
  7. "justMyCode": false,"stopOnEntry": true...
  8. Remove cache, pip cache, temp files..
  9. Remove virtual environment and add virtual env again...

Below are the VS Code details: Version: 1.69.1 (user setup) Commit: b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a Date: 2022-07-12T08:21:24.514Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Windows_NT x64 10.0.19042

Below is my launch.json file

"version": "0.2.0",
"configurations": [
    {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal",
        "justMyCode": false,
        "stopOnEntry": true
    },
    {
        "name": "Attach to Python Functions",
        "type": "python",
        "request": "attach",
        "port": 9091,
        "preLaunchTask": "func: host start"
    }

Solution

  • Solved the issue by adding extensions.json, tasks.json, settings.json file along with launch.json file in .vscode folder