将 VS Code 升级到版本 1.79.1 后,当我尝试在管理模式下启动时,它会抛出错误。没有管理模式启动就可以工作。添加错误的屏幕截图和下面的版本详细信息。
窗口意外终止(原因:'启动失败',代码:'18')
谷歌搜索“
github vscode issues windows administrator code 18
”,我发现了这个问题票:Can't run as Administrator - launch-failed code 18
#185057,其中维护者说:
请参阅 https://code.visualstudio.com/docs/setup/windows#_unable-to-run-as-admin-when-applocker-is-enabled 以管理员身份启动。
目前
无法按预期工作,正在 #184687 中解决,修复将在 1.79.2 中提供。--no-sandbox
来自链接的用户文档:
引入进程沙箱(在此博客文章中讨论),由于运行时沙箱的限制,配置 AppLocker 时当前不支持以管理员身份运行。如果您的工作需要从提升的终端运行 VS Code,您可以使用
启动code
作为解决方法。--no-sandbox --disable-gpu-sandbox
订阅问题#122951以接收更新。
在 VS Code 1.79.2 发布之前,您可以尝试使用 VS Code Insiders 与
--no-sandbox --disable-gpu-sandbox
。
显然更新到 1.79.2 并没有为一些用户解决这个问题。我仍在关注问题单,并将随着情况的发展更新此答案。
请注意,在 VS Code 1.80 中,有一个新标志 --disable-chromium-sandbox
--no-sandbox --disable-gpu-sandbox
,以及您可能感兴趣的其他一些相关功能。
code --no-sandbox --disable-gpu-sandbox
启动第二个实例
--无沙箱后来发现我们可以通过更改文件来永久做到这一点
argv.json位于
C:\Users\用户名.vscode并包括以下代码行来禁用沙箱
“禁用铬沙箱”:true对文件进行更改后,内容将如下所示
{
// Use software rendering instead of hardware accelerated rendering.
// This can help in cases where you see rendering issues in VS Code.
// "disable-hardware-acceleration": true,
// Allows to disable crash reporting.
// Should restart the app if the value is changed.
"enable-crash-reporter": true,
// Unique id used for correlating crash reports sent from this instance.
// Do not edit this value.
"crash-reporter-id": "fed916dc-7e1a-4cdf-a0a1-dbeab24c5d3f",
"disable-chromium-sandbox": true
}
欲了解更多信息,请参阅此