The Solutions:
Solution 1: Launch VS Code with `–no-sandbox` and `–disable-gpu-sandbox` flags
To resolve the issue, launch VS Code with the `–no-sandbox` and `–disable-gpu-sandbox` flags. These flags disable sandboxing, which can cause problems when launching VS Code in admin mode. To launch VS Code with these flags, follow these steps:
- Open an instance of VS Code running as a normal user.
- In the terminal, run the following command: `code –no-sandbox –disable-gpu-sandbox`
Solution 2: Run with No Sandbox Option
Due to process sandboxing, running Visual Studio Code in administrator mode is currently unsupported when AppLocker is enabled. To bypass this limitation, launch Code with the following command:
code --no-sandbox --disable-gpu-sandbox
However, note that this workaround is only available until VS Code 1.79.2 is released. For a more permanent solution, you can subscribe to issue #122951 on GitHub for updates.
Q&A
Why Visual Studio Code 1.79.1 launch in admin mode fails with code 18?
Administrator mode is unsupported with AppLocker due to runtime sandbox limitations, use –no-sandbox –disable-gpu-sandbox.
Which issue can be referred for more details on this error?
#185057: Unable to run as administrator – launch-failed code 18.
Video Explanation:
The following video, titled "How to Fix Microsoft Visual Studio Code Open a Folder or ...", provides additional insights and in-depth exploration related to the topics discussed in this post.
In This Video We Will See How to Fix Microsoft Visual Studio Code Open a Folder or Workspace Live Server Error or VSCode Here Are The Steps ...
The following video, titled "How to Fix Microsoft Visual Studio Code Open a Folder or ...", provides additional insights and in-depth exploration related to the topics discussed in this post.
In This Video We Will See How to Fix Microsoft Visual Studio Code Open a Folder or Workspace Live Server Error or VSCode Here Are The Steps ...