microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.05k stars 29.22k forks source link

Unable to run sandboxed process when run as elevated under applocker #122951

Open moward opened 3 years ago

moward commented 3 years ago

Steps to Reproduce:

  1. Open a markdown file, and click the "Open preview to the side" button
  2. The preview window is blank, and an error notification pops up in the bottom right:

    Error loading webview: Error: Could not register service workers: TypeError: Failed to register a ServiceWorker for scope ('vscode-webview://36f8a74c-37c6-4d60-9d4c-87414f69ebcc/') with script ('vscode-webview://36f8a74c-37c6-4d60-9d4c-87414f69ebcc/service-worker.js?platform=electron&id=36f8a74c-37c6-4d60-9d4c-87414f69ebcc&vscode-resource-origin=https%3A%2F%2F36f8a74c-37c6-4d60-9d4c-87414f69ebcc.vscode-webview-test.com'): ServiceWorker cannot be started.

The same thing happens for other WebViews, like opening an extension from the Extensions sidebar, or using the "Issue Reporter".

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

baermathias commented 3 years ago

I get this issue when trying to open Git History (https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory). This used to work a few days ago, but now the window is blank with the error message: Screenshot from 2021-07-08 10-24-39

Full Error Message: Error loading webview: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state..

haugerbr commented 3 years ago

@baermathias unless you are seeing every webview fail, that might be a different issue. The error you pasted looks different than the one that causes all webviews to fail.

jsasvollaro commented 3 years ago

I have the same issue. I am using admin account Steps to Reproduce:

1.open and starting editing a .md file 2.Ctrl Shift V

Error loading webview: Error: Could not register service workers: TypeError: Failed to register a ServiceWorker for scope ('vscode-webview://df7ac3d0-c2ac-465a-a4ff-da7a213619c4/') with script ('vscode-webview://df7ac3d0-c2ac-465a-a4ff-da7a213619c4/service-worker.js?platform=electron&id=df7ac3d0-c2ac-465a-a4ff-da7a213619c4&vscode-resource-base-authority=vscode-resource.vscode-webview.net&swVersion=2'): ServiceWorker cannot be started.

grandrew commented 3 years ago

image

Don't know if it is the same issue, no WebView opens in either of my windows, local/remote

Version: 1.58.0
Commit: 2d23c42a936db1c7b3b06f918cde29561cc47cd6
Date: 2021-07-08T06:53:55.113Z
Electron: 12.0.13
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Linux x64 5.4.0-74-generic snap
eduncan911 commented 3 years ago

Running vscode 1.58.1 on Linux.

Multiple extensions that use WebView all error with:

Error loading webview: Error: Could not register service workers: InvalidStateError: 
Failed to register a ServiceWorker: The document is in an invalid state..

code --no-sandbox does not help, same errors.

However, changing my --user-data-dir (that forced a re-install of all extensions) did make it work!

Obviously, that is not preferred due to many years of customizing - that I do not want to start all over with.

Ubuntu 21.04
---
Version: 1.58.1
Commit: 2aeda6b18e13c4f4f9edf6667158a6b8d408874b
Date: 2021-07-13T06:20:02.397Z
Electron: 12.0.13
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Linux x64 5.11.0-7620-generic snap
$ code --verbose .
[1580288:0721/131142.013405:ERROR:appcenter_api.cc(55)] expecting appcenter url prefix
/snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so)
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so
(code:1580288): Gtk-WARNING **: 13:11:42.028: Failed to parse /home/eric/.config/gtk-3.0/settings.ini: Key file does not start with a group
[main 2021-07-21T17:11:42.256Z] Sending env to running instance...
[main 2021-07-21T17:11:42.345Z] Sent env to running instance. Terminating...
[main 2021-07-21T17:11:42.345Z] Lifecycle#kill()

(it's installed via Snap)

Developer Tools before opening a file that uses webview has this error:

(node:1580425) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. 
Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.(Use `code --trace-deprecation ...` 
to show where the warning was created) (at writeOut (internal/process/warning.js:43:3))
m @ console.ts:137

Developer Tools after I open a file that fails webview:

Webview fatal error: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state..
(anonymous) @ main.js:631
async function (async)
(anonymous) @ main.js:629
(anonymous) @ host.js:27
notificationsAlerts.ts:40 

Error loading webview: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state..
onDidChangeNotification @ notificationsAlerts.ts:40
(anonymous) @ notificationsAlerts.ts:26
fire @ event.ts:583
addNotification @ notifications.ts:206
error @ notificationService.ts:92
(anonymous) @ baseWebviewElement.ts:210
(anonymous) @ webviewElement.ts:168

Additional info:

$ code --list-extensions
austin.code-gnu-global
be5invis.vscode-icontheme-nomo-dark
budparr.language-hugo-vscode
cssho.vscode-svgviewer
DavidAnson.vscode-markdownlint
dbaeumer.vscode-eslint
DigitalBrainstem.javascript-ejs-support
DotJoshJohnson.xml
dphans.micropython-ide-vscode
eg2.vscode-npm-script
equinusocio.vsc-material-theme-icons
esbenp.prettier-vscode
fivethree.vscode-hugo-snippets
golang.go
hediet.vscode-drawio
jamesmaj.easy-icons
janisdd.vscode-edit-csv
jdinhlife.gruvbox
jebbs.plantuml
JuanBlanco.solidity
magicstack.MagicPython
minhthai.vscode-todo-parser
mitaki28.vscode-clang
ms-azuretools.vscode-docker
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-vscode.cpptools
ms-vscode.Theme-MarkdownKit
ms-vsliveshare.vsliveshare
ms-vsliveshare.vsliveshare-audio
ms-vsliveshare.vsliveshare-pack
mushan.vscode-paste-image
mutantdino.resourcemonitor
nopeslide.vscode-drawio-plugin-mermaid
phplasma.csv-to-table
PKief.material-icon-theme
platformio.platformio-ide
redhat.vscode-yaml
rid9.datetime
Shan.code-settings-sync
smlombardi.theme-tesla
Stephanvs.dot
streetsidesoftware.code-spell-checker
vsciot-vscode.vscode-arduino
yzhang.markdown-all-in-one

Here's my settings.json that has been scrubbed from sensitive information:

// Place your settings in this file to overwrite the default settings
{
  "workbench.colorTheme": "Gruvbox Dark Soft",
  "workbench.activityBar.visible": true,
  //"workbench.iconTheme": "vscode-icons",
  //"workbench.iconTheme": null,
  "editor.cursorBlinking": "solid",
  //"editor.fontFamily": "'Go Mono'",
  "editor.fontLigatures": true,
  "editor.renderIndentGuides": false,
  "editor.minimap.enabled": false,
  "editor.tabSize": 2,
  "editor.stickyTabStops": true,
  "editor.formatOnSave": true,
  "editor.defaultFormatter": null,
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.codeActionsOnSave": {
    "source.fixAll": true
  },
  "files.insertFinalNewline": true,
  "files.trimFinalNewlines": true,
  "files.trimTrailingWhitespace": true,
  "explorer.openEditors.visible": 0,
  "explorer.confirmDelete": false,
  "explorer.confirmDragAndDrop": false,
  "extensions.autoUpdate": false,
  //"terminal.integrated.fontFamily": "Go Mono, Inconsolata-dz for Powerline",
  "terminal.integrated.lineHeight": 0,
  "window.openFilesInNewWindow": "off",
  "extensions.ignoreRecommendations": true,
  "explorer.compactFolders": false,
  "vim.enableNeovim": true,
  "vim.disableAnnoyingNeovimMessage": true,
  "go.testOnSave": true,
  "go.coverOnSave": true,
  "go.useCodeSnippetsOnFunctionSuggest": true,
  "go.autocompleteUnimportedPackages": true,
  "go.useLanguageServer": true,
  "C_Cpp.intelliSenseEngine": "Default",
  "sync.gist": "(snip)",
  "sync.lastUpload": "2018-07-02T18:38:38.162Z",
  "sync.autoDownload": true,
  "sync.autoUpload": true,
  "sync.lastDownload": "2018-02-19T15:13:34.109Z",
  "sync.forceDownload": false,
  "sync.anonymousGist": false,
  "sync.host": "",
  "sync.pathPrefix": "",
  "sync.quietSync": true,
  "sync.askGistName": false,
  "vsicons.dontShowNewVersionMessage": true,
  "python.pythonPath": "",
  "workbench.startupEditor": "newUntitledFile",
  "python.linting.enabled": true,
  "python.linting.pylintEnabled": true,
  "python.linting.pylamaEnabled": false,
  "python.linting.pycodestyleEnabled": false,
  "python.linting.flake8Enabled": false,
  "sync.removeExtensions": true,
  "sync.syncExtensions": true,
  "extensions.autoCheckUpdates": false,
  "update.showReleaseNotes": false,
  "telemetry.enableCrashReporter": false,
  "telemetry.enableTelemetry": true,
  "npm.fetchOnlinePackageInfo": true,
  "workbench.enableExperiments": false,
  "workbench.settings.enableNaturalLanguageSearch": false,
  "sync.forceUpload": true,
  "zenMode.hideTabs": false,
  "dateTime.use24HourClock": false,
  "dateTime.showAMPM": true,
  "resmon.show.cpufreq": false,
  "resmon.show.cputemp": true,
  "resmon.show.cpuusage": false,
  "resmon.show.mem": false,
  "debug.console.fontSize": 12.5,
  "markdown.preview.fontSize": 12.5,
  "editor.fontSize": 12.5,
  "terminal.integrated.fontSize": 12.5,
  "workbench.colorCustomizations": {
    "[Tesla]": {
      "activityBar.background": "#232323EE",
      "editor.inactiveSelectionBackground": "#3d3d3d",
      "editor.selectionBackground": "#636363",
      "editor.selectionHighlightBackground": "#505050",
      "scrollbar.shadow": "#23232300",
      "sideBar.background": "#232323EE",
      "statusBar.background": "#23232300",
      //"statusBar.background": "#000000FF",
      //"statusBar.border": "#3B3B3B",
      "statusBar.foreground": "#969696",
      "statusBar.debuggingBackground": "#511f1f",
      "statusBar.debuggingBorder": "#8b1818",
      "statusBar.debuggingForeground": "#FFFFFF",
      "tab.activeBorderTop": "#3d3d3d"
    },
    "terminal.background": "#282828",
    "terminal.foreground": "#D5C4A1",
    "terminalCursor.background": "#D5C4A1",
    "terminalCursor.foreground": "#D5C4A1",
    "terminal.ansiBlack": "#282828",
    "terminal.ansiBlue": "#83A598",
    "terminal.ansiBrightBlack": "#665C54",
    "terminal.ansiBrightBlue": "#83A598",
    "terminal.ansiBrightCyan": "#8EC07C",
    "terminal.ansiBrightGreen": "#B8BB26",
    "terminal.ansiBrightMagenta": "#D3869B",
    "terminal.ansiBrightRed": "#FB4934",
    "terminal.ansiBrightWhite": "#FBF1C7",
    "terminal.ansiBrightYellow": "#FABD2F",
    "terminal.ansiCyan": "#8EC07C",
    "terminal.ansiGreen": "#B8BB26",
    "terminal.ansiMagenta": "#D3869B",
    "terminal.ansiRed": "#FB4934",
    "terminal.ansiWhite": "#D5C4A1",
    "terminal.ansiYellow": "#FABD2F"
  },
  "editor.suggest.showIcons": false,
  "workbench.editor.showIcons": true,
  //"workbench.iconTheme": "material-icon-theme",
  //"workbench.iconTheme": null,
  "breadcrumbs.enabled": false,
  "window.menuBarVisibility": "toggle",
  "cSpell.userWords": [
    "snipped"
  ],
  "files.associations": {
    "**/*.yml": "ansible"
  },
  "go.formatTool": "gofmt",
  "go.coverageOptions": "showUncoveredCodeOnly",
  "go.coverOnSingleTest": true,
  "go.coverOnSingleTestFile": true,
  "go.coverShowCounts": true,
  "terminal.integrated.tabs.enabled": true,
  "javascript.updateImportsOnFileMove.enabled": "always",
  "window.zoomLevel": 1,
  "hediet.vscode-drawio.customFonts": [
    "Go",
    "Go Medium",
    "Go Mono",
    "Go, Bold",
    "Go Mono, Bold",
    "Go Medium, Bold"
  ],
  "hediet.vscode-drawio.local-storage": "(snip)",
  "TodoParser": {
    "folderExclude": ["node_modules", ".vscode"],
    "showInProblems": true,
    "markers": [
      ["TODO", "Warning"],
      ["FIXME", "Warning"]
    ],
    "autoDefaultMarkers": true
  },
  "hediet.vscode-drawio.theme": "min",
  "hediet.vscode-drawio.codeLinkActivated": false,
  "docker.showStartPage": false,
  "[markdown]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "emmet.includeLanguages": {
    "ejs": "html"
  },
  "workbench.editorAssociations": {
    "*.ipynb": "jupyter.notebook.ipynb"
  },
  "workbench.iconTheme": "eq-material-theme-icons-darker",
  "typescript.updateImportsOnFileMove.enabled": "always",
  "files.exclude": {
    "**/node_modules": true
  },
  "redhat.telemetry.enabled": false
}

I tried to downgrade to VSCode 1.55; but, when opening a file now for webview, it doesn't seem to trigger the extensions any longer (something broke).

deepak1556 commented 3 years ago

@eduncan911 and others who are facing the issue on linux, please open a separate issue as the root cause is unrelated. This issue only tracks the problem on windows due to chromium sandbox disallowing to start the service worker process when run as elevated.

eduncan911 commented 3 years ago

@deepak1556 all other Linux issues related to this were closed as Duplicates, and pointed to this long thread. That means people need to retrospectively find and re-open those other issues.

Also, doesn't this ticket have the Linux label ? ¯\_(ツ)_/¯

deepak1556 commented 3 years ago

Sorry about the incorrect labelling, have reopened the linux issue.

lleeoo commented 3 years ago

FWIW I have been using 1.58.2 and did not encounter this issue until this morning, when I had to reboot to install some patch that my employer required. The --no-sandbox workaround seems to have resolved it for now, at least insofar as Jupyter and Markdown are concerned.

version info:

Version: 1.58.2 (user setup) Commit: c3f126316369cd610563c75b1b1725e0679adfb3 Date: 2021-07-14T22:10:15.214Z Electron: 12.0.13 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Windows_NT x64 10.0.19043

BastienL972 commented 3 years ago

Hi got the exact same issue nothing worked so far v1.58.2 except launching VScode non-elevated.

hito0512 commented 3 years ago

Hi got the exact same issue nothing worked so far v1.58.2 except launching VScode non-elevated.

got same issue. It may be related to the fact that I open tensorboard for a long time in vscode

Version: 1.59.0 Commit: 3794** Date: 2021-08-04T23:13:20.182Z Electron: 13.1.7 Chrome: 91.0.4472.124 Node.js: 14.16.0 V8: 9.1.269.36-electron.0 OS: Linux x64 5.4.0-74-generic snap

siddtheone commented 3 years ago

I had similar issue on Ubuntu, For me upgrading VScode to 1.59 and google chrome to 92 fixed the issue.

p3t3r5 commented 3 years ago

After Upgrade to 1.59 i don't get any error popups. But no Webviews work (Extention details, Version about, etc...) My VSCode is installed on networkdrive (user setup). All extentions and settings to (setx VSCODE_EXTENSIONS "%APPDATA%\Code\Extensions") --no-sandbox param to exe is a workaround...

hh23485 commented 3 years ago

Actually, 1.59 on windows, still can't open the any web view extension, even no error popup, any solutions or fix plan?

snoe925 commented 3 years ago

View of the Release Notes: 1.59.1 caused "Error loading webview: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state ..."

On windows there was another VSCode window holding a lock the Cache directory. The folder could not be renamed. When I attempted to move it by hand I can see the error that the Cache folder was locked by another VSCode process.

[47160:0828/110905.134:ERROR:cache_util_win.cc(20)] Unable to move the cache: Access is denied. (0x5) [47160:0828/110905.134:ERROR:cache_util.cc(144)] Unable to move cache folder C:\Users\somebody\AppData\Roaming\Code\Cache to C:\Users\somebody\AppData\Roaming\Code\old_Cache_000 [47160:0828/110905.134:ERROR:disk_cache.cc(184)] Unable to create cache [36220:0828/110906.647:ERROR:service_worker_storage.cc(1895)] Failed to delete the database: Database IO error

Shutdown all the processes. And restart cleanly and the error is fixed. I can now view Release notes in the Webview.

stegrams commented 3 years ago

I noticed a left out process tree after closing my VSCode and search for "code" on my system monitor. When I terminated it and reopen VSCode, the problem was resolved.

OS: "Ubuntu 20.04.3 LTS (Focal Fossa)" VSCode version: 1.59.1 Commit: 3866c3553be8b268c8a7f8c0482c0c0177aa8bfa Date: 2021-08-19T11:54:37.513Z Electron: 13.1.7 Chrome: 91.0.4472.124 Node.js: 14.16.0 V8: 9.1.269.36-electron.0 OS: Linux x64 5.11.0-27-generic snap

FG-Baba commented 3 years ago

Any updates on issue solution? running VSCode as admin and unable to view extension webview in app. --no-sandbox workaround does not really help

AntonOfTheWoods commented 3 years ago

@deepak1556 could you provide a link to the Linux issue you reportedly re-opened?

Like many others, I searched through 10s of auto-closed issues and chains of auto-generated "look at this issue" before coming across this issue. While I acknowledge that probably saves you a lot of time, it is an objectively horrible experience for users faced with genuine bugs.

Thanks!

xscd commented 3 years ago

I think the Linux issue is https://github.com/microsoft/vscode/issues/125993

irvingzhang0512 commented 3 years ago

Any updates? Hope this issue could be fixed asap....

Xuhv commented 3 years ago

I downgraded code to 1.55 and then upgraded it to 1.61 . Now it works fine. I don't know the reasons.

joshxyzhimself commented 3 years ago

Persisting now even after restart of VSCode at v1.61.2

joshxyzhimself commented 3 years ago

Fixed with restart of Ubuntu at v1.61.2

stegrams commented 3 years ago

@joshxyzhimself restarting VSCode is not always the same as restarting all of its background processes. Please check my Aug 29 comment or restart your system to be sure.

runkanrenchu commented 3 years ago

i found this same issue today after installing some markdown viewer extension. uninstalling it didn't work, and reloading the window didn't work. however closing it and re-opening it worked. no ghost processes. no idea why :/

Version: 1.61.2 (user setup) Commit: 6cba118ac49a1b88332f312a8f67186f7f3c1643 Date: 2021-10-19T14:57:20.575Z Electron: 13.5.1 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 6.1.7601

eleach commented 3 years ago

I've been struggling with this for weeks now on Ubuntu. Is --no-sandbox the way to run as not elevated? I am using it but still have the "can't open any webviews" problem. I've also cleared the cache and killed all code processes. Still have the problem. Thanks.

stegrams commented 3 years ago

@eleach if the issue is solved by restarting your system, then you may left some relevant processes alive.

tiago-eusebio-dev commented 2 years ago

I'm having the same issue. If I run VSCode as administrator I can't preview any WebView content. I really need to run as administrator in order to my mouse's horizontal scroll wheel to work.

Version: 1.62.0 (system setup) Commit: b3318bc0524af3d74034b8bb8a64df0ccf35549a Date: 2021-11-03T15:23:01.379Z Electron: 13.5.1 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19042

MaxCastella commented 2 years ago

I'm having the same issue since 1.56. I use VSCode for PowerShell scripting and I have no choice but to run it elevated because of PowerShell's Constrained Language Mode. Then extensions like GitGraph or Thunder Client doesn't work because of this webview bug.

Version: 1.63.0-insider (system setup) Commit: c1096372119bcf83b9bd8ccee96dcf266f35de76 Date: 2021-11-11T13:18:41.690Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.18363

My only workaround is to downgrade to this version : Version: 1.55.2 (system setup) Commit: 3c4e3df9e89829dce27b7b5c24508306b151f30d Date: 2021-04-13T09:35:57.887Z Electron: 11.3.0 Chrome: 87.0.4280.141 Node.js: 12.18.3 V8: 8.7.220.31-electron.0 OS: Windows_NT x64 10.0.18363

VanMSFT commented 2 years ago

Having the same issue. Only solution is to downgrade to 1.55.2

ruiminwang commented 2 years ago

We're having the same issue.

  1. can't open developer tools when run as Administrator
  2. can't open webview of our extension Azure Stream Analytics Tools. This is also affecting our customers. Some customers need to run our extension Azure Stream Analytics Tools under Administrator because of some company security policy. But they can't use all the features related with webview.

The vscode version I used to repro the issue is: Version: 1.63.2 (user setup) Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3 Date: 2021-12-15T09:40:02.816Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19044

Could anyone provide a timeline for fix and new bits?

PaulNacamuli commented 2 years ago

Still getting a blank screen with any preview or report issue. No longer getting a webview error.

Version: 1.63.2 (system setup) Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3 Date: 2021-12-15T09:40:02.816Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19042

Xenom-FD commented 2 years ago

I had the same problem in VSCode even without using administrator permissions, I would close it and reopen it but it still didn't work. Fortunately it was solved by opening the Windows task manager and closing the VSCode processes.

Version: 1.63.2 (user setup) Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3 Date: 2021-12-15T09:40:02.816Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.22000

MaxCastella commented 2 years ago

I had the same problem in VSCode even without using administrator permissions, I would close it and reopen it but it still didn't work. Fortunately it was solved by opening the Windows task manager and closing the VSCode processes.

I don't think it's the same problem if you experience it without using administrator permission. If I kill the code.exe process, the problem persists for me.

Version: 1.64.0-insider (system setup) Commit: 2c967bf892d52550fabae08347faae57a4539b03 Date: 2022-01-24T05:15:04.924Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.18363

jcmrva commented 2 years ago

Still getting this on 1.67.1 not running as Administrator. Closing all VS Code instances usually fixes it.

MaxCastella commented 2 years ago

The --no-sandbox parameter fixed it for me (running as admin).

Grauenwolf commented 2 years ago

Can we make a  --no-sandbox a config setting?

shezzor commented 2 years ago

Also still seeing this in 1.67.1 while not running as Administrator. As people have mentioned, closing all instances of VSCode and restarting generally fixes the issue.

lawhorkl commented 2 years ago

I encountered this issue today while updating some markdown files. We have code in our stack that requires an older version of VSCode (v1.59.1) to run.

We also have recently started building a .NET 6 project as part of another project which we need v1.65.0 to run. Because of this we have both versions installed side by side and the markdown preview (which uses a webview) on v1.65.0 stopped working the other day

I found that when I fully closed both versions of VSCode and opened the newer version the markdown preview feature of VSCode began working again.

I assume this has to do with one instance of the application claiming all of the service workers before the other instance starts up.

This may not be the ultimate solution to the issue but if this setup sounds familiar and you are encountering this error this may be worth a try.

xiuliren commented 2 years ago

I killed existing related processes, this works again for me.

ps aux | grep -i vscode | less
pkill -f vscode
alexhass commented 2 years ago

Since 1.66 as non-admin nothing works anymore. "no-sandbox" param works as a workaround, but sounds not like the right way doing it. Can you fix this serious bug, please?

shikari7 commented 2 years ago

I'm having this issue too, on Windows 10. It's been months (maybe even over a year) since I've used vscode. The client frame comes up but doesn't paint over what is behind it on the screen, about 30 seconds passes and it dies. I tried reinstalling, no effect. I am running it as a normal user and I installed it as a normal user (no admin). This is the output of code -v:

1.68.1
30d9c6cd9483b2cc586687151bcbcd635f373630
x64

I found this issue and tried running it with --no-sandbox, and it works. Hope this helps.

deepak1556 commented 2 years ago

Hi all, as we are getting close to enabling the chromium sandbox for the remaining VSCode application processes https://github.com/microsoft/vscode/issues/92164, we would like to understand if this issue continues for users with latest insiders https://code.visualstudio.com/insiders and if it does, please provide the following data points.

MaxCastella commented 2 years ago

Hi,

Version: 1.69.0-insider (system setup) running elevated

Version: 1.69.0-insider (user setup) running elevated

Version: 1.69.0-insider (user setup) running non-elevated

Version: 1.69.0-insider (user setup) running elevated with --no-sandbox

Hope this helps.

deepak1556 commented 2 years ago

This is helpful info, thanks @JustGuybrush . Running as elevated under applocker is not supported by the runtime, refs: https://bugs.chromium.org/p/chromium/issues/detail?id=740132. There seems to be a workaround implemented in the Edge browser https://textslashplain.com/2021/01/07/sandboxing-vs-elevated-browsing-as-administrator. If others in this issue are also running under similar setup then we will have to think about backporting the workaround for VSCode.

MaxCastella commented 2 years ago

Thanks @deepak1556. Sadly, AppLocker is mandatory in my company.

deepak1556 commented 2 years ago

@JustGuybrush in https://github.com/microsoft/vscode/issues/122951#issuecomment-1173763559 you had also tried to run the application as non-elevated. Is it not possible to use this mode by default ? Can you also provide context on why the application needs to be launched as elevated ?

MaxCastella commented 2 years ago

I use vscode to develop and debug PowerShell scripts. And because of AppLocker, PowerShell is run in Constrained Language Mode, disabling a lot of needed features. https://devblogs.microsoft.com/powershell/powershell-constrained-language-mode/

JtMotoX commented 2 years ago

I am also getting this error when trying to preview markdown with the new Visual Studio Code Server with serve-local.

Seems to work fine when running the server on macOS but getting this error when running on Ubuntu.

galogm commented 2 years ago

I killed existing related processes, this works again for me.

ps aux | grep -i vscode | less
pkill -f vscode

I encountered this problem after upgrading vscode server and solved it by killing all existing vscode-server processes and restarting vscode all over.

In my case, this seems to be related to some conflicts between the upgrade operation and the previous processes.