Attempting to access the camera or microphone either through code or the console will result in the chrome instance crashing
"trace": true in launch config):Steps to reproduce:
This works for me in js-debug. Did you previously deny camera access on localhost:N? That would prevent it from prompting again.

Maybe, I changed the url to google.com and then I get the crash with js-debug too.
hm, still works for me there. Can you or loadpixels get a trace log?
The log shows a normal launch then disconnection, I don't think there's anything interesting. I tried with "userDataDir": false, setting a port to use that instead of the debug pipe, and commenting out all the flags we set when we spawn Chrome.
One thing I noticed, if I start Chrome from the terminal and do this, then after I click Allow, I get a macOS prompt to allow iTerm access to the camera. So maybe vscode/Electron doesn't want to allow access to the camera.
@loadpixels what OS are you on?
@roblourens MacOS
echoing @connor4312 there's no tracelog to speak of, it just crashes
it happens as soon as I click the Allow button on the permissions dialog
I experience the same problem. MacOS. I accept camera, and chrome immediately exits. Under VS Code debug only, works well in browser.
You can use an "attach" type config to work around this. I don't have anything better, sorry.
Doesn't seem to happen on Windows. Tracking upstream with: https://bugs.chromium.org/p/chromium/issues/detail?id=1066155
This will be fixed in https://github.com/microsoft/vscode/pull/94728
After discussion in the Chromium issue, we have opened a feature request here: https://bugs.chromium.org/p/chromium/issues/detail?id=1070364
Once that is ready we will need to do a small amount of work to support it.
Hi, any updates on this? browser crashes for me too when trying to allow microphone permissions.
We're still waiting on work from the Chromium team for this
Hi, still no updates on this? My browser crashes for me too when trying to allow microphone permissions.
What's the workaround here?
Work around:
Start Chrome with debug enabled
OSX:
use attach in launch.json
"name": "Chrome",
"type": "chrome",
"request": "attach",
"port": 9222,
"webRoot": "${workspaceFolder}/src",
Perhaps helpful:
Starting chrome with debug enabled still crashes on MacOS once navigator.mediaDevices.getUserMedia is invoked.
Google Chrome 86.0.4240.80聽(Official Build)聽(x86_64)
OS macOS Version 10.15.7
Command Line /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --remote-debugging-port=9222 --flag-switches-begin --flag-switches-end
Debug Extension v4.12.11
Has anyone found any reasonable workaround? It's difficult to debug applications that use MediaDevices.
@robclouth, use the suggestion from @murray-minito above. Not ideal, but works for now.
Chrome: Version 87.0.4280.67 (Official Build) (x86_64)
OS: macOS Catalina 10.15.7
the problem is still here((
@amnporter it doesn't work. Still crashes when getUserMedia is called as @Odame has said, even when not debugging.
It's been working for me since trying it
On chrome 87.0.4280.67 if I start with --remote-debugging-port=9222 and run navigator.getUserMedia({video:true},devices=>{console.log('hello')},err=>{console.log(err)}) from the console it crashes, even without connecting vscode.
I think this is chrome issue, not vscode
[1121/143318.062403:WARNING:process_memory_mac.cc(93)] mach_vm_read(0x7ffee480b000, 0x2000): (os/kern) invalid address (1)
[1121/143318.177972:WARNING:crash_report_exception_handler.cc(240)] UniversalExceptionRaise: (os/kern) failure (5)
This happens with the firefox VSCode debugger as well. It looks like running the debugging server on either FF or Chrome doesn't have the correct 'entitlements' on Mac OS, due to notarization changes with 10.14+. Any user media permissions will instantly crash the application.
The only way out seems to be a separately notarized app dedicated to running as a debug server, with all these entitlements enabled.
I was able by allowing vscode permissions for camera and microphone, but I had to create these entitled permissions in first place.
Have a look at this:
https://github.com/microsoft/vscode/issues/95062#issuecomment-751241372
Now all works for me when started directly from vscode!
MacOS Catalina (10.15.7)
@isometriq thank you, I tried the solution you provided, and it works!
but I had to change the inserted code, because there were some other required fields in my access table:
INSERT into access (service, client, client_type, allowed, prompt_count) VALUES ("kTCCServiceCamera","com.microsoft.VSCode",0, 1, 0);
INSERT into access (service, client, client_type, allowed, prompt_count) VALUES ("kTCCServiceMicrophone","com.microsoft.VSCode",0, 1, 0);
@Tereshka hey you're right, I add to tweak some fields and value
This'll work in the next VS Code stable release https://github.com/microsoft/vscode/issues/119787#issuecomment-810484265
Most helpful comment
I was able by allowing vscode permissions for camera and microphone, but I had to create these entitled permissions in first place.
Have a look at this:
https://github.com/microsoft/vscode/issues/95062#issuecomment-751241372
Now all works for me when started directly from vscode!
MacOS Catalina (10.15.7)