question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VS Code still have to access internet when installing extensions with local VSIX file

See original GitHub issue

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

  • VS Code Version: 1.63.2
  • OS Version: Windows 10 20H2 and Ubuntu 18.04.5 (with remote-ssh scenario)

Steps to Reproduce:

  • Scenario A: Install extension with a VSIX file using command line tool on Windows 10 or Ubuntu 18.04.5
  1. Prepare an extension vsix file (e.g., Prettier or Python)
  2. Use the following command to install extension with the vsix file
code --install-extension <path to the vsix file>
  • Scenario B: Install extension with a VSIX file using VS Code UI on Windows 10
  1. Prepare an extension vsix file (e.g., Prettier or Python)
  2. In the “Extensions” view, click “Install from VSIX” and select the vsix file to be installed.
  • Scenario C: Install extension with a VSIX file using VS Code UI on remote Ubuntu Server (remote-ssh activated)
  1. Setup remote-ssh extension and environment settings
  2. Connect to the remote Ubuntu server
  3. In the remote-ssh VS Code window, click “Install from VSIX” and select the vsix file on the remote Ubuntu server to be installed.

Problem States:

In my company network, both local Windows PC and remote Ubuntu Linux terminal server are not allowed to access internet with firewall settings blocked. Therefore, I downloaded the extension vsix files in my home and sent them to my company PC and installed them with the steps mentioned above. However, I found that when installing extensions from vsix files, before VS Code start to extract contents from the vsix files, VS Code still tried to access the Microsoft marketplace, which makes it waste a lot of time (about 2minutes per installation) waiting VS Code request timeout and then start to do the extraction and installation. In my understanding, all the content needed for installing an extension are all included in the vsix file. Why do VS Code still need to send POST request to marketplace every time at the beginning when installing from vsix file? Or, if is it possible to provide a configuration option to disable this behavior, or at least make users have a chance to set the timeout value for requests sent by VS Code to Microsoft marketplace?

Here is the log when installing extension with vsix file on my PC which can access internet (I set --log trace), as you can see, it accessed the marketplace in the log TRACE RequestService#request https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery

TRACE Started scanning user extensions
 INFO CLI main {
  _: [],
  diff: false,
  add: false,
  goto: false,
  'new-window': false,
  'reuse-window': false,
  wait: false,
  help: false,
  'list-extensions': false,
  'show-versions': false,
  'install-extension': [
    'C:\\Users\\mtk23649.DOMAIN_MTK\\Desktop\\VSCode Portable\\extensions\\esbenp.prettier-vscode\\esbenp.prettier-vscode-9.1.0.vsix'
  ],
  'pre-release': false,
  version: false,
  verbose: false,
  log: 'trace',
  status: false,
  'prof-startup': false,
  'no-cached-data': false,
  'prof-v8-extensions': false,
  'disable-extensions': false,
  'disable-gpu': false,
  'ms-enable-electron-run-as-node': false,
  telemetry: false,
  debugRenderer: false,
  logExtensionHostCommunication: false,
  'skip-release-notes': false,
  'skip-welcome': false,
  'disable-telemetry': false,
  'disable-updates': false,
  'disable-keytar': false,
  'disable-workspace-trust': false,
  'disable-crash-reporter': false,
  'skip-add-to-recently-opened': false,
  'unity-launch': false,
  'open-url': false,
  'file-write': false,
  'file-chmod': false,
  'driver-verbose': false,
  force: false,
  'do-not-sync': false,
  trace: false,
  'force-user-env': false,
  'force-disable-user-env': false,
  'open-devtools': false,
  __sandbox: false,
  'no-proxy-server': false,
  'no-sandbox': false,
  nolazy: false,
  'force-renderer-accessibility': false,
  'ignore-certificate-errors': false,
  'allow-insecure-localhost': false,
  logsPath: 'C:\\Users\\mtk23649.DOMAIN_MTK\\Desktop\\VSCode Portable\\stables\\VSCode-win32-x64-1.63.2\\data\\user-data\\logs\\20220211T152929'
}
Installing extensions...
TRACE Started scanning user extensions
TRACE Scanned user extensions: 4
TRACE Scanned user extensions: 4
(node:28292) [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)
TRACE Started scanning user extensions
TRACE Scanned user extensions: 4
TRACE ExtensionManagementService#install file:///c%3A/Users/mtk23649.DOMAIN_MTK/Desktop/VSCode%20Portable/extensions/esbenp.prettier-vscode/esbenp.prettier-vscode-9.1.0.vsix
 INFO Installing extension: esbenp.prettier-vscode
TRACE Started scanning system extensions
TRACE Started scanning user extensions
TRACE Scanned user extensions: 4
TRACE Scanned system extensions: 86
TRACE Started scanning system extensions
TRACE Started scanning user extensions
TRACE Scanned user extensions: 4
TRACE Scanned system extensions: 86
TRACE Started scanning user extensions
TRACE Scanned user extensions: 4
TRACE RequestService#request https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery
TRACE resolveShellEnv(): skipped (Windows)
TRACE Started extracting the extension from c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\extensions\esbenp.prettier-vscode\esbenp.prettier-vscode-9.1.0.vsix to C:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [ADDED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
TRACE [File Watcher (node.js)] [CHANGED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224
 INFO Extracted extension to C:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\.3be0a99b-f662-4b55-8289-5651a1ebb224: esbenp.prettier-vscode
TRACE [File Watcher (node.js)] [ADDED] c:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\esbenp.prettier-vscode-9.1.0
 INFO Renamed to C:\Users\mtk23649.DOMAIN_MTK\Desktop\VSCode Portable\stables\VSCode-win32-x64-1.63.2\data\extensions\esbenp.prettier-vscode-9.1.0
 INFO Extracting completed. esbenp.prettier-vscode
 INFO Extension installed successfully: esbenp.prettier-vscode
Extension 'esbenp.prettier-vscode-9.1.0.vsix' was successfully installed.

Here is the log when installing extension from vsix file on the PC which can’t access internet: (It spent too much time, just like the program freezed, so I stop the process by Ctrl-C)

Installing extensions...
TRACE Started scanning user extensions
TRACE Extension VSIX downlads cache dir does not exist
TRACE Scanned user extensions: 0
TRACE Scanned user extensions: 0
(node:30321) [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)
TRACE Started scanning user extensions

TRACE Scanned user extensions: 0
TRACE ExtensionManagementService#install file:///proj/mtk23649/garmin.private-extension-manager-1.8.0.vsix
INFO Installing extension: garmin.private-extension-manager
TRACE Started scanning system extensions
TRACE Started scanning user extensions
TRACE Scanned user extensions: 0
TRACE Scanned system extensions: 85
TRACE RequestService#request https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery
TRACE resolveShellEnv(): skipped (VSCODE_CLI is set)
^C

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:26
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
hsinyinfucommented, Aug 29, 2022

Yes, I also tested installing from a vsix file when my “personal PC” is completed out of internet by removing the ethernet cable from the PC (no remote-ssh to remote Linux server, and no any firewall policy), and it did complete very quickly. So you’re right, the behavior is different in an complete offline (no any network access) vs limited-access (e.g., the request is blocked by outbound firewall policy) environment.

image

1reaction
hsinyinfucommented, Aug 25, 2022

Yes, I’m saying that I think VS Code took so much time installing an extension offline from a vsix file because it reaches out the Microsoft marketplace first before starting extracting contents from the vsix file. And even in the latest 1.70.2 version, the problem is still there.

image

As you can see in the screenshot above, there is a time gap for about 2 minutes bettwen the log “Installing extension” and the log “Extracted extension”. Also, in the Network view of the built-in Developer tool, there are two extensionquery events, one failed, and the other failed due to connection timeout.

In addition, I screenshoted the log of VS Code during installing this extension offline (set log level to trace) shown below. Most time was spent on the request to https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery (where I marked with a yellow rectangle). image

To be clear, the offline installation always succeeds. However, the main problem is that it takes too much time trying to reach out the Microsoft marketplace, which is not necessary in my opinion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Managing Extensions in Visual Studio Code
You can browse and install extensions from within VS Code. Bring up the Extensions view by clicking on the Extensions icon in the...
Read more >
To install the extension on a system not connected to the Internet
At the top of the EXTENSIONS view, click More Actions (...), and choose Install from VSIX... from the drop-down menu. Extensions > More...
Read more >
How can I install Visual Studio Code extensions offline?
Install the exact version of VSCode on online machine. Then turn off updates by going to File -> Preferences -> Settings . In...
Read more >
VS Code How to Install Extensions - Alphr
1. Click on the “Extensions” button in the Activity Bar. It’s located on the side of VS Code’s client. Alternatively, you can use...
Read more >
VS Code extensions - Gitpod
For the current workspace only - if you don't want extensions to be synced across workspaces, select Install (Do Not Sync) instead of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found