vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Unable to launch browser: Unable to attach to browser

Open HO-COOH opened this issue 9 months ago • 31 comments

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.96.4
  • OS Version: Windows 11

Steps to Reproduce:

  1. Create a launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "msedge",
            "request": "launch",
            "name": "Launch Edge against localhost",
            "url": "http://localhost:5173",
            "webRoot": "${workspaceFolder}"
        }
    ]
}
  1. Launch debug

Image

Edge clearly there, user setting all cleared.

HO-COOH avatar Feb 05 '25 17:02 HO-COOH

/jsDebugLogs

connor4312 avatar Feb 05 '25 21:02 connor4312

Please collect trace logs using the following instructions:

If you're able to, add "trace": true to your launch.json and reproduce the issue. The location of the log file on your disk will be written to the Debug Console. Share that with us.

⚠️ This log file will not contain source code, but will contain file paths. You can drop it into https://microsoft.github.io/vscode-pwa-analyzer/index.html to see what it contains. If you'd rather not share the log publicly, you can email it to [email protected]

Are you running as administrator on Windows?

connor4312 avatar Feb 06 '25 18:02 connor4312

Are you running as administrator on Windows?

@connor4312 Nope. And it was working a few days before. And if I am running as admin, the titlebar of vscode should show it.

HO-COOH avatar Feb 07 '25 02:02 HO-COOH

I have the same problem since today, any solutions yet? VS Code version 1.97.0. This was working on friday, today (monday) on the first work day it stopped working.

nograx avatar Feb 10 '25 10:02 nograx

I also have the same problem in VSCode insider only, I tried the same project with the stable version and it works fine. So this seems like a problem introduced recently in the insider version. Another test I made was to change it to the deprecated type="chrome" and that works too even with the insider version.

To summarize, it seems to be a problem with msedge only in the insider version, but it does work with chrome

ghiscoding avatar Feb 12 '25 00:02 ghiscoding

Same here. I had a VS code update and all of a sudden, I got the popup so I now have to debug with chrome which makes me unhappy !

GearTheWorld avatar Feb 12 '25 14:02 GearTheWorld

This happened to me today! It was running fine all day long and then all of a sudden I got that error and it won't work anymore. Got a visual studio code update notification one minute later...updated..SAME issue. Note: I did not exit or stop debugging or updated visual studio code before this happened. The only thing I can think of is that edge updated itself during the debugging(I was closing the browser during my work to debug session data handling, but anyway it's now completely dead. switching to type "chrome" and using chrome works without issues. Something was definitely updated today, but with the state of windows update I can only guess what if anything happened in the background.

vscodelog.json

Looooooka avatar Feb 12 '25 17:02 Looooooka

Thanks all, can you confirm what version of Edge you're using?

I've not changed anything in this area recently (and the original report is from a user on the previous version of VS Code released in December) so I suspect something upstream could have changed.

connor4312 avatar Feb 12 '25 17:02 connor4312

The version it's trying to launch: Version 133.0.3065.59 (Official build) (64-bit) on Windows 11 Pro 10.0.26100 Build 26100

Looooooka avatar Feb 12 '25 18:02 Looooooka

Microsoft Edge Version 133.0.3065.59 (Official build) (64-bit)

OS Name Microsoft Windows 11 Pro Version 10.0.26100 Build 26100

GearTheWorld avatar Feb 12 '25 19:02 GearTheWorld

Thanks. Have any of you installed extensions in the debug version of Edge that VS Code launches?

connor4312 avatar Feb 12 '25 21:02 connor4312

I also most probably have the same Edge version as above since it got auto-updated as well. I'm also on Win11 but on 23H2

@connor4312 I'm not exactly sure what you mean by your comment/question. Are you asking if any of us installed the Edge VSCode extension, is that what you're asking? If that is the case then I only tried to install after I got the error, but that didn't help, it doesn't make any difference and is erroring in both cases.... unless you're asking if we have any extensions installed? If so, then yes a bunch of them

Image

I also just tried on my work laptop (Win10, 22H2) on the same project and the Edge Debugger was working until I updated/restarted Edge and then it failed. So I can confirm that Edge is really the root cause. I assume that you might then ask to start VSCode without extensions, so I went ahead and disabled all my extensions (by hand) and the end result is the same, I always get the error now that I'm on latest Edge version 133.0.3065.59. Another thing too, I thought my VSCode stable was ok but it turns out that after retrying it, I can confirm both VSCode stable/insider now have the with Edge since it got updated, so it's definitely a regression introduced by Edge

ghiscoding avatar Feb 12 '25 22:02 ghiscoding

My edge versions definitely got update today. Tried the trick with disabling updates through policies and installing an older version of edge(the enterprise installer). Didn't work. Also tried installing Edge Dev version 134.0.3124.5 and adding "runtimeExecutable":"C:/Program Files (x86)/Microsoft/Edge Dev/Application/msedge.exe" to the launch command... no luck so far

Looooooka avatar Feb 12 '25 23:02 Looooooka

Maybe it's good to mention that for me no update on edge or Windows happened between the time it was good and now with this issue. BUT I remember that VS Code was updated because I saw the page of what's new popping and it is at that moment, the issue appeared. I honestly don't know if it's related but as I say, nothing on the edge side or Windows side happened to my knowledge

GearTheWorld avatar Feb 13 '25 00:02 GearTheWorld

Happened to me today after updating to 1.97.1. Exiting vscode and starting it again fixed it.

bmakan avatar Feb 13 '25 07:02 bmakan

It happened after updating to 1.97.1. Exiting vscode and launching it again fixed the problem, however I had to uninstall the extension from Microsoft Edge Tools. I hope it helps.

Renan-Santana avatar Feb 13 '25 12:02 Renan-Santana

Can we have a fix or a workaround rapidly ?

GearTheWorld avatar Feb 13 '25 15:02 GearTheWorld

I was able to resolve the issue by installing the Microsoft Edge Tools extension for VS Code. After following the steps shown in the extension's GIF, that's basically right-clicking on the HTML file and selecting "Open with Edge"—the browser opened in VS Code. I then closed it and tried running it again with the normal debugger, which fixed the problem.

Zaker04 avatar Feb 14 '25 03:02 Zaker04

@Zaker04 I tried and here's my observation in one screenshot ;)

Image

GearTheWorld avatar Feb 14 '25 15:02 GearTheWorld

I believe I accidentally deleted my comment since I can't see it. After trying older versions of edge and visual studio code I figured out what's causing my issues(IT IS DEFINITELY AN EDGE UPDATE PROBLEM BTW). I had visual studio code shortcut set to "Run with administrative permissions". After the latest edge update this kills debugging when using msedge attach or request settings. Unchecking the run with administrative permissions checkbox fixes debugging for all Visual Studio Code versions including the preview version! They must have changed something with permission elevation in the last browser updates(beta, dev, canary and stable). Hope this helps someone!

Looooooka avatar Feb 14 '25 16:02 Looooooka

I confirm. Removing RUN AS ADMINISTRATOR solved the issue

GearTheWorld avatar Feb 14 '25 17:02 GearTheWorld

"Run as administrator" I think should not have ever worked since Edge auto-relaunches itself in deelevated mode when started as a administrator, which breaks the debug connection. But maybe their relaunching stopped working for sometime and was fixed in this update.

Is that the same issue others are hitting here?

connor4312 avatar Feb 14 '25 18:02 connor4312

I've had that shortcut for over a year if not longer so if that's the case it was broken for a long long time. I'm just glad it works again and I don't have to use chrome anymore.

Looooooka avatar Feb 14 '25 19:02 Looooooka

Happened to me today after updating to 1.97.1. Exiting vscode and starting it again fixed it.

I noticed this issue while running 1.97.2. Restarting VS Code also fixed the issue for me

fossbrandon avatar Feb 20 '25 01:02 fossbrandon

@connor4312 I've never run VS Code as administrator on this laptop, nor have I run Edge as administrator, but I'm getting the same issue. Windows 11 Pro. Hit this issue for the first time today after updating VS Code.

Version: 1.97.2 (user setup) Commit: e54c774e0add60467559eb0d1e229c6452cf8447 Date: 2025-02-12T23:20:35.343Z Electron: 32.2.7 ElectronBuildId: 10982180 Chromium: 128.0.6613.186 Node.js: 20.18.1 V8: 12.8.374.38-electron.0 OS: Windows_NT x64 10.0.26100

Edge version: Version 133.0.3065.82 (Official build) (64-bit)

LarsKemmann avatar Feb 28 '25 15:02 LarsKemmann

UPDATE: It so happens that Edge had an update queued for me that I just installed after posting that comment. It now seems to work!! I didn't change anything else or do anything else. New version is Edge Version 133.0.3065.92 (Official build) (64-bit).

LarsKemmann avatar Feb 28 '25 15:02 LarsKemmann

Had the same issue today, I updated edge and then it worked. it's weird because launching chrome also did not work. I have installed VScode for all the user

ghost avatar Mar 07 '25 06:03 ghost

Starting VScode one time as administrator and run the app in debug solve the issue in my case. After this, debugging also worked if I started VScode without administrator rights.

Jam5 avatar Mar 07 '25 08:03 Jam5