vscode-js-debug: Launchservices causes timeout discovering browsers on OSX
Describe the bug Debugging via chrome appears to broken after upgrade.
To Reproduce Steps to reproduce the behavior:
- Goto debug section
- Click settings and add basic Launch Chrome
- Click run
- See error:
Error processing launch: Error: Could not attach to main target
at Object.t.timeoutPromise (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:1:33028)
at f.prepareLaunch (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:15:2619737)
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async f.launch (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:15:2620329)
at async t.Binder.captureLaunch (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:73:25637)
at async t.Binder._launch (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:73:25208)
at async Promise.all (index 6)
at async t.Binder._boot (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:73:24468)
at async t.default._onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js:15:2459238)
Log File
Gz json file seems to be corrupt.
VS Code Version: 1.47.0
Additional context MacOSX
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 18 (9 by maintainers)
Commits related to this issue
- feat: look up well-known paths on osx first See: https://github.com/microsoft/vscode-js-debug/issues/570 — committed to microsoft/vscode-js-debug-browsers by connor4312 4 years ago
- fix: probe well-known paths for browsers first Fixes #570 — committed to microsoft/vscode-js-debug by connor4312 4 years ago
- fix: probe well-known paths for browsers first Fixes #570 — committed to microsoft/vscode-js-debug by connor4312 4 years ago
This will be fixed in today’s nightly build (published at 5 PM PST). Thank you for your help in diagnosing this!
Yea, the previous debugger just probed pre-set paths. The downside is that if you have the browser installed on some non-default path, you would of course need to fiddle with configuration. But we could also do the probing to provide fast launches for common cases
Okay, thanks!
It looks like the thing eating up time for you is trying to find the path to Chrome on your machine. To do this we read output from OSX’ launch services tool. You should be able to get around this by either:
timeout
property of your launch.json, e.g. to 20 seconds from 10 secondstimeout: 20000
runtimeExecutable
which will avoid having to run discovery logic.This seems to have a pretty low incidence rate; I think a decent solution here is caching the browser path to avoid needing to look up multiple times. It will still time out once in this case, but should thereafter work.
Yeah specifying 20 seconds makes it work, just to note with v4.12.8 of the debugger for chrome it starts straight away without any delay.