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:

  1. Goto debug section
  2. Click settings and add basic Launch Chrome
  3. Click run
  4. 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

Most upvoted comments

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:

  • Increasing the timeout property of your launch.json, e.g. to 20 seconds from 10 seconds timeout: 20000
  • Manually specifying the path to Chrome in the 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.