microsoft / vscode

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

Offline installation of extensions fail with unmeaningful error message "XHR failed" #130962

Closed Schwefelsaeure closed 3 years ago

Schwefelsaeure commented 3 years ago

I have to work in an environment without an internet connection. There, I installed VS Code 1.59 with the C/C++ extension. Furthermore, I wanted to install the CMake Tools extension to build my project.

But, the installation of the CMake Tools extension failed with an unmeaningful error message in the bottom right corner "XHR failed".

VSCode-XHR-failed

As it turned out here, VS Code tried to download the dependency CMake Extension.

My tip: Instead of just displaying "XHR failed" it would be better to report "Dependency xyz could not be feched" or something like this. Otherwise, users are lost and cannot solve the problem themselves.

insane-shane commented 3 years ago

I believe VS Code 1.59 introduced a bug that breaks installing extensions from the .vsix files while offline when the extension has dependencies declared in the extensionPack or extensionDependencies portion of the manifest. Attempting to install the extension will fail. Previous versions of VS Code installed the extension but reported that it could not install other dependencies.

The issue is when two extensions list each other as dependencies. For example, the Python extension tries to install Pylance, and Pylance tries to install Python. It is impossible to install either. See the below logs. Note that the extension is successfully installed when using VS Code 1.58.2.

Python extension version: ms-python.python-2021.8.1105858891

Version: 1.59.0 (user setup) Commit: 379476f0e13988d90fab105c5c19e7abc8b1dea8 Date: 2021-08-04T23:13:12.822Z Electron: 13.1.7 Chrome: 91.0.4472.124 Node.js: 14.16.0 V8: 9.1.269.36-electron.0

1.59_install.log

[2021-08-17 15:05:36.642] [sharedprocess] [info] Installing extension: ms-python.python
[2021-08-17 15:05:36.751] [sharedprocess] [error] Error while preparing to install dependencies and extension packs of the extension: ms-python.python
[2021-08-17 15:05:36.752] [sharedprocess] [error] Error: XHR failed
    at XMLHttpRequest.v.onerror (vscode-file://vscode-app/c:/Users/insane/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:21:11471)
[2021-08-17 15:05:36.752] [sharedprocess] [error] Failed to install extension: ms-python.python XHR failed

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.18363

1.58.2_install.log

[2021-08-17 15:18:40.542] [sharedprocess] [info] Installing the extension: ms-python.python
[2021-08-17 15:18:57.213] [sharedprocess] [info] Extracted extension to c:\Users\insane\.vscode\extensions\.777a2d93-3997-4d21-9294-ff93a78db3c5: ms-python.python
[2021-08-17 15:18:57.271] [sharedprocess] [info] Renamed to c:\Users\insane\.vscode\extensions\ms-python.python-2021.8.1105858891
[2021-08-17 15:18:57.276] [sharedprocess] [info] Installation completed. ms-python.python
[2021-08-17 15:18:57.457] [sharedprocess] [warning] Cannot install packed extensions of extension: ms-python.python XHR failed
[2021-08-17 15:18:57.458] [sharedprocess] [info] Successfully installed the extension: ms-python.python
sandy081 commented 3 years ago

To verify:

Schwefelsaeure commented 3 years ago

Thanks for addressing and working on this issue. I will give it a try with the next release.

Myraa commented 3 years ago

@sandy081 I got the similar error while installing salesforce extension pack (https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode). Can you advise? [2021-08-23 11:22:08.071] [renderer1] [error] ["validating: Corrupt ZIP: end of central directory record signature not found"," at .downloadInstallableExtension (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:58:196354)"," at async .doRun (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:58:195331)"] [2021-08-23 11:22:08.092] [renderer1] [error] Corrupt ZIP: end of central directory record signature not found: validating: Corrupt ZIP: end of central directory record signature not found at .downloadInstallableExtension (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:58:196354) at async .doRun (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:58:195331)

juan113d commented 3 years ago

Install 1.58 until problem is fixed.