question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unbound breakpoints in late loaded scripts

See original GitHub issue

Description I’m struggling to make breakpoints work in scripts that are loaded after the application started. My setup is the following:

The first component is an Electron application that is started using a node launch configuration (titled “Electron launcher”) to gain access to the main process. It is located in ${env:ProgramFiles}/FoundryVTT/resources/app.

The second component is a module loaded by that application. It is located by the application from ${env:AppData}/../Local/FoundryVTT/Data/modules, which I override to ${workspaceRoot}/src using a path mapping. It is accessed using a chrome attach configuration titled “FoundryVTT”.

Issue: When setting a breakpoint in my module file “statuscounter.js” while it is loaded, it binds correctly. If I restart or reload the application, the breakpoint no longer binds.

There is also a second breakpoint in “foundry.js”, which is located in ${env:ProgramFiles}/FoundryVTT/resources/app/public and is loaded at runtime by the Electron renderer process, which I also want to debug. This one is located using the web root and has the same issue.

Files Here are the logs for the renderer (b3a…) and launcher (f94…) processes: vscode-debugadapter-b3a3b767.json.gz vscode-debugadapter-f940b5b0.json.gz

They include both an unsuccessful bind at the start and a succesful one near the end (when I reset the breakpoint while everything is loaded), which have the same (correct) path.

This is the launch configuration: launch.zip

It works as expected using the legacy debugger.

Versions VSCode: 1.56.2 Node.js: 14.16.0 Electron: 12.0.7 Debugger for Chrome 4.12.12

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
TylerLeonhardtcommented, Jul 6, 2021

@connor4312 can I use pwa-msedge instead of pwa-chrome? Verified if so. (I don’t have Chrome installed and I like it that way 😄 )

0reactions
connor4312commented, Jul 6, 2021
  1. Have a launch config without a URL, for example delete this line from the web-worker demo: https://github.com/microsoft/vscode-js-debug/blob/58311075a4e0cf8096176d02f63dffcd4a9ce44c/demos/web-worker/.vscode/launch.json#L11
  2. Set a breakpoint in some source code
  3. Serve it however, F5 and manually navigate to the page
  4. Verify the breakpoint is bound and hit
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unbound breakpoint - Angular, VS Code, Chrome, PWA
Mine is a PWA and I always have an unbound breakpoint when starting with "ng serve". Tried change in angular. json: "sourceMap": true...
Read more >
Breakpoints in javascript code not bound / hit
open() are not bound or hit. If I fall back to debugging under IE 11 (ugh) the breakpoints are hit. There are many...
Read more >
Solve “Breakpoint ignored” with Visual Studio code (vscode ...
scripts command in Debug console to see the loaded scripts. Make sure the paths of the scripts is correct. 2. Open source map...
Read more >
How to debug React app in VSCode - YouTube
Learn how to debug your React app in VSCode.Are you using this functionality in your workflow? Do you have any tips for other...
Read more >
Debugger | Node.js v19.3.0 Documentation
The debugger automatically breaks on the first executable line. To instead run until the first breakpoint (specified by a debugger statement), set the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found