debugging 如何在VS Code中启动调试会话时附加并打开Firefox浏览器?

ut6juiuv  于 2023-03-23  发布在  其他
关注(0)|答案(1)|浏览(167)

bounty将在9小时后到期。回答此问题可获得+100声望奖励。user1186050正在寻找来自信誉良好的来源的答案

使用VS Code,我在Chrome或Edge中调试应用时没有问题。当我开始调试时,Chrome/Edge浏览器打开,我看到了我的应用。我可以设置断点并调试我的应用,没有问题。
但是现在我想使用Firefox进行调试,所以我安装了“Debugger for Firefox”扩展(不确定是否需要),在Firefox浏览器的开发人员工具部分选中“启用远程调试”,在下面的launch.json中创建了一个新的启动配置,然后启动了一个调试器会话。

问题-在VS Code控制台中启动调试器看起来很好,但Firefox(浏览器)无法打开或连接到我的调试会话。
问题-我下面的配置设置正确了吗?还是我需要做一些其他的事情才能让VS Code打开Firefox并附加到它?我看了扩展页面的详细信息,但不确定我是否需要做其他事情?我需要路径Map吗?我需要在Firefox中做其他事情吗?

"compounds": [{
  "name": "Server/ClientFirefox",
  "configurations": ["Launch .NET6 (no web)", "Launch Firefox"]
}],
"configurations": [{
    "name": "Launch Firefox",
    "type": "firefox",
    "request": "launch",
    "reAttach": true,
    "url": "https://localhost:4200",
    "webRoot": "${workspaceFolder}/client"
  },
  {
    "name": "Launch .NET6 (no web)",
    "type": "coreclr",
    "request": "launch",
    "preLaunchTask": "build",
    "program": "${workspaceFolder}/API/bin/Debug/net6.0/API.dll",
    "args": [],
    "cwd": "${workspaceFolder}/API",
    "stopAtEntry": false,
    "env": {
      "ASPNETCORE_ENVIRONMENT": "Development"
    },
    "sourceFileMap": {
      "/Views": "${workspaceFolder}/Views"
    }
  }
]

仅供参考-以下是我的Chrome启动配置:

{
  "name": "Launch Pwa-Chrome",
  "type": "pwa-chrome",
  "request": "launch",
  "url": "https://localhost:4200",
  "webRoot": "${workspaceFolder}/client"
},
ht4b089n

ht4b089n1#

我把它修好了。

// modified to work - removed "reAttach" and modified other properties to other similar configs w/ port:4200 and client folder
{
  "name": "Launch Firefox",
  "type": "firefox",
  "request": "launch",
  "url": "https://localhost:4200",
  "webRoot": "${workspaceFolder}/client"
},

// created by VS Code
{
  "type": "firefox",
  "request": "launch",
  "reAttach": true,
  "name": "Launch localhost",
  "url": "http://localhost/index.html",
  "webRoot": "${workspaceFolder}"
},

相关问题