microsoft / vscode-js-debug

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more
MIT License
1.67k stars 281 forks source link

Breakpoints get unbound on debug session start #1183

Closed mightymietz closed 2 years ago

mightymietz commented 2 years ago

Describe the bug When I start a debug session with a set breakpoint in a js file the breakpoint gets unbound as soon as the debug session starts. Disabling and enabling the same breakpoint turns it red again and it then breaks correctly. When I restart the session the issue starts again. Putting the debugger statement inside the js file breaks at the line everytime correctly.

To Reproduce Steps to reproduce the behavior:

  1. install xampp
  2. install wordpress to c:\xampp\htdocs\wordpress
  3. add debug config to launch.json
  4. add breakpoint inside js file
  5. start debug session
  6. watch issue

This seems to be related to a local webserver set up and might be a path mapping issue. So here is the configuration:

xampp webserver wordpress installed to c:\xampp\htdocs\wordpress

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-msedge",
            "request": "launch",
            "name": "Launch Edge against localhost",
            "url": "http://localhost/wordpress",
            "webRoot": "${workspaceFolder}",
            "trace": true
        } 
    ]
}

pwa log vscode-debugadapter-1813e8b1.json.gz

connor4312 commented 2 years ago

Yea, this is a path mapping issue. You set a breakpoint in

c:/xampp/htdocs/wordpress/wp-content/plugins/inlivity-product-configurator/functions/js/main.js

(which is also outside your workspace folder of:)

C:\LocalProjects\WP-Plugin-Dev\inlivity_product_configurator

And it was ultimately served from

http://localhost/wordpress/wp-content/plugins/inlivity-product-configurator/functions/js/main.js

So that route needs to be mapped to the folder you're setting breakpoints in.