microsoft / vscode

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

Remote-SSH does not work with 1.54 and --extensions-dir option #118812

Closed shkit closed 3 years ago

shkit commented 3 years ago

Steps to Reproduce:

  1. install(extract zip) VSCode to C:\VSCode
  2. start VSCode with "--extensions-dir Z:\home\.vscode\extensions" option
  3. click Remote Explorer
  4. show these logs in "Log (Extension Host)" window.
    [2021-03-05 13:57:35.164] [exthost] [error] Activating extension ms-vscode-remote.remote-ssh failed due to an error:
    [2021-03-05 13:57:35.168] [exthost] [error] Error: [nullExtensionDescription]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api nullExtensionDescription
    at f (c:\VSCode\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:74959)
    at Object.p [as checkProposedApiEnabled] (c:\VSCode\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:74906)
    at Object.registerRemoteAuthorityResolver (c:\VSCode\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:95:35427)
    at t.activate (z:\home\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.0\out\extension.js:127:113555)
    at Function._callActivateOptional (c:\VSCode\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:14037)
    at Function._callActivate (c:\VSCode\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:13714)
    at c:\VSCode\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:11746
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 0)

Does this issue occur when you try this locally?: Yes Does this issue occur when you try this locally and all extensions are disabled?: Yes

I uninstalled all extensions and re-install remote-ssh only, same result. I do not use --extensions-dir, works fine. I used 1.53.x and --extensions-dir, works fine.

nhance commented 3 years ago

Seeing this as well

jcastrov commented 3 years ago

I usually have my extensions in another directory, and I have this issue since VSCode updated to 1.54 as well. I ran the steps you mentioned, and I found the --extensions-dir option only works if you specify a path in the default .vscode directory, but any other path is not working.

ViPod5 commented 3 years ago

Having the same issue with the "portable" vscode installation i.e. when the ./data sub-directory is present. Downgrading VSCode to 1.53.2 fixes the issue for me.

Add: same error is present when activating vscode.git too:

[2021-03-09 07:31:07.398] [exthost] [error] Activating extension vscode.git failed due to an error:
[2021-03-09 07:31:07.399] [exthost] [error] Error: [nullExtensionDescription]: Proposed API is only available when running out of dev or with the following command line switch: --enable-proposed-api nullExtensionDescription
sandy081 commented 3 years ago

Also assigning to @jrieken as error is related to proposed api check.

@jrieken any thoughts?

jrieken commented 3 years ago

We have a data structure that allows to look up an extension by file path. When require is called we check what file is calling it and we associate the caller with an extension. This is used to instantiate the vscode-API per extension.

This seems to fail when --extensions-dir is used and then we use a fallback, which is nullExtensionDescription (see error logs above)

Proposed API not working is only a small part of the problem. All "extension-scoped" APIs, like memento storage, key sync, or secrets won't work because of this. I don't know where the root cause is, but I would say that extensionLocation might be wrong

jrieken commented 3 years ago

Likely/maybe because of them being on a different disk (""--extensions-dir Z:\home.vscode\extensions" option")

jrieken commented 3 years ago

@shkit Can you attach the logs from the extension host? They can be accessed via "F1 > Show Logs > Extension Host". The log should contain a message that starts with "Could not identify extension for 'vscode' require call from". I am very interested in that message and the lines following that.

Also a question regarding the Z drive from which you are starting. Is that an actual drive or was it created via the subst command?

ViPod5 commented 3 years ago

@jrieken My drives have all been created by using regedit.

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"A:"="\\??\\C:\\Mount\\Apps"

But I am not convinced that's the reason, because even when I call everything by it's physical path i.e. c:\Mount\Apps\Code\code.exe the problem is still there.

EDIT: I stand corrected. The issue is NOT present when code.exe is started from command prompt with cwd being the actual physical path i.e. NOT using the subst.

ViPod5 commented 3 years ago

@jrieken Here is my log.

extention_host_log.txt

jrieken commented 3 years ago

Thats for sharing the log, this is the interesting piece:

[2021-03-12 13:09:27.606] [exthost] [warning] Could not identify extension for 'vscode' require call from a:\Code1.54.1\resources\app\extensions\microsoft-authentication\dist\extension.js. These are the extension path mappings: 
    c:\Mount\Apps\Code1.54.1\data\extensions\adammaras.overtype-0.2.0 -> adammaras.overtype
    c:\Mount\Apps\Code1.54.1\data\extensions\bierner.markdown-checkbox-0.1.3 -> bierner.markdown-checkbox
    c:\Mount\Apps\Code1.54.1\data\extensions\bierner.markdown-emoji-0.1.0 -> bierner.markdown-emoji
    c:\Mount\Apps\Code1.54.1\data\extensions\bierner.markdown-yaml-preamble-0.0.4 -> bierner.markdown-yaml-preamble
    c:\Mount\Apps\Code1.54.1\data\extensions\davidanson.vscode-markdownlint-0.39.0 -> DavidAnson.vscode-markdownlint
    c:\Mount\Apps\Code1.54.1\data\extensions\dbaeumer.vscode-eslint-2.1.17 -> dbaeumer.vscode-eslint
    c:\Mount\Apps\Code1.54.1\data\extensions\equinusocio.vsc-material-theme-33.2.0 -> Equinusocio.vsc-material-theme
    c:\Mount\Apps\Code1.54.1\data\extensions\equinusocio.vsc-material-theme-icons-1.2.2 -> equinusocio.vsc-material-theme-icons
    c:\Mount\Apps\Code1.54.1\data\extensions\felixfbecker.php-intellisense-2.3.14 -> felixfbecker.php-intellisense
    c:\Mount\Apps\Code1.54.1\data\extensions\firefox-devtools.vscode-firefox-debug-2.9.2 -> firefox-devtools.vscode-firefox-debug
    c:\Mount\Apps\Code1.54.1\data\extensions\formulahendry.code-runner-0.11.3 -> formulahendry.code-runner
    c:\Mount\Apps\Code1.54.1\data\extensions\goessner.mdmath-2.5.1 -> goessner.mdmath
    c:\Mount\Apps\Code1.54.1\data\extensions\gruntfuggly.todo-tree-0.0.204 -> Gruntfuggly.todo-tree
    c:\Mount\Apps\Code1.54.1\data\extensions\james-yu.latex-workshop-8.16.1 -> James-Yu.latex-workshop
    c:\Mount\Apps\Code1.54.1\data\extensions\mhutchie.git-graph-1.29.0 -> mhutchie.git-graph
    c:\Mount\Apps\Code1.54.1\data\extensions\ms-python.python-2021.2.636928669 -> ms-python.python
    c:\Mount\Apps\Code1.54.1\data\extensions\ms-python.vscode-pylance-2021.3.1 -> ms-python.vscode-pylance
    c:\Mount\Apps\Code1.54.1\data\extensions\ms-toolsai.jupyter-2021.3.619093157 -> ms-toolsai.jupyter
    c:\Mount\Apps\Code1.54.1\data\extensions\ms-vscode-remote.remote-containers-0.163.2 -> ms-vscode-remote.remote-containers
    c:\Mount\Apps\Code1.54.1\data\extensions\ms-vscode-remote.remote-ssh-0.65.1 -> ms-vscode-remote.remote-ssh
    c:\Mount\Apps\Code1.54.1\data\extensions\ms-vscode-remote.remote-ssh-edit-0.65.1 -> ms-vscode-remote.remote-ssh-edit
    c:\Mount\Apps\Code1.54.1\data\extensions\ms-vscode-remote.remote-wsl-0.54.3 -> ms-vscode-remote.remote-wsl
    c:\Mount\Apps\Code1.54.1\data\extensions\ms-vscode.cpptools-1.2.2 -> ms-vscode.cpptools
    c:\Mount\Apps\Code1.54.1\data\extensions\ms-vscode.hexeditor-1.4.0 -> ms-vscode.hexeditor
    c:\Mount\Apps\Code1.54.1\data\extensions\redhat.java-0.76.0 -> redhat.java
    c:\Mount\Apps\Code1.54.1\data\extensions\visualstudioexptteam.vscodeintellicode-1.2.11 -> VisualStudioExptTeam.vscodeintellicode
    c:\Mount\Apps\Code1.54.1\data\extensions\vscjava.vscode-java-debug-0.32.0 -> vscjava.vscode-java-debug
    c:\Mount\Apps\Code1.54.1\data\extensions\vscjava.vscode-java-dependency-0.18.1 -> vscjava.vscode-java-dependency
    c:\Mount\Apps\Code1.54.1\data\extensions\vscjava.vscode-java-pack-0.13.0 -> vscjava.vscode-java-pack
    c:\Mount\Apps\Code1.54.1\data\extensions\vscjava.vscode-java-test-0.28.1 -> vscjava.vscode-java-test
    c:\Mount\Apps\Code1.54.1\data\extensions\vscjava.vscode-maven-0.28.0 -> vscjava.vscode-maven
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\configuration-editing -> vscode.configuration-editing
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\css-language-features -> vscode.css-language-features
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\debug-auto-launch -> vscode.debug-auto-launch
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\debug-server-ready -> vscode.debug-server-ready
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\emmet -> vscode.emmet
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\extension-editing -> vscode.extension-editing
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\git -> vscode.git
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\git-ui -> vscode.git-ui
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\github -> vscode.github
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\github-authentication -> vscode.github-authentication
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\github-browser -> vscode.github-browser
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\grunt -> vscode.grunt
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\gulp -> vscode.gulp
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\html-language-features -> vscode.html-language-features
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\image-preview -> vscode.image-preview
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\jake -> vscode.jake
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\json-language-features -> vscode.json-language-features
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\markdown-language-features -> vscode.markdown-language-features
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\merge-conflict -> vscode.merge-conflict
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\microsoft-authentication -> vscode.microsoft-authentication
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\ms-vscode-remote.remote-wsl-recommender -> ms-vscode-remote.remote-wsl-recommender
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\ms-vscode.js-debug -> ms-vscode.js-debug
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\ms-vscode.js-debug-companion -> ms-vscode.js-debug-companion
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\ms-vscode.node-debug -> ms-vscode.node-debug
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\ms-vscode.node-debug2 -> ms-vscode.node-debug2
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\ms-vscode.references-view -> ms-vscode.references-view
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\ms-vscode.vscode-js-profile-table -> ms-vscode.vscode-js-profile-table
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\npm -> vscode.npm
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\php-language-features -> vscode.php-language-features
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\search-result -> vscode.search-result
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\simple-browser -> vscode.simple-browser
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\testing-editor-contributions -> vscode.testing-editor-contributions
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\typescript-language-features -> vscode.typescript-language-features
    c:\Mount\Apps\Code1.54.1\resources\app\extensions\vscode-account -> vscode.vscode-account

When loading the microsoft-authentication extension we think it is at c:\Mount\Apps\Code1.54.1\resources\app\extensions\microsoft-authentication whereas nodejs tells us it is at a:\Code1.54.1\resources\app\extensions\microsoft-authentication\dist\extension.js

I stand corrected. The issue is NOT present when code.exe is started from command prompt with cwd being the actual physical path i.e. NOT using the subst.

This is very interesting. We use realpath and that "expands" paths that include subst-drives. We do that because nodejs-require should be doing the same. It seems that this doesn't happen anymore (in some cases) In consequence, we cannot associate the file making the require-call with an extension and then things fall apart

ViPod5 commented 3 years ago

Investigated a little bit more and the problem is also present when using for instance net use v: \\localhost\c$\Mount\Apps

jrieken commented 3 years ago

@VincencPodobnik I have pushed an optimistic change and I would very thankful if you can give that a try.

Thanks in advance

ViPod5 commented 3 years ago

@jrieken Thank you very much.

Steps taken:

  1. Downloaded
  2. Exatrcted to A:\Code_MS_TEST
  3. .\data directory from A:\Code copied to A:\Code_MS_TEST\.
  4. Started from command prompt using substs' drive letter A:\Code_MS_TEST>"Code - Insiders.exe"
  5. Problem unfortunatelly still present. insiders_through_subst_extention_host_log.txt

Retried starting from windows explorer; same outcome.

Starting from command prompt with cwd circumventing subst still works.

jrieken commented 3 years ago

Thanks for the detailed steps. I am now able to see the same. It seems that somehow the extension locations have been "normalized" to C:-based paths whereas the filename from the require-request doesn't get that treatment... There seems to be differences between realpath and realpath.native, tho my understanding was the realpath should work the same in this case...

Screenshot 2021-03-12 at 15 43 33
shkit commented 3 years ago

@jrieken Thanks for investigating. I think the same thing happens in my environment.

My VM's Z: drive does not seems to be subst drive, but seems remote drive.

Here is my Extension Host Log.

[2021-03-15 08:27:00.619] [exthost] [warning] Could not identify extension for 'vscode' require call from z:\home\.vscode\extensions\aaron-bond.better-comments-2.1.0\out\extension.js. These are the extension path mappings: 
    \\XXX-XXXXXXXXXXX\UserData-O\XXXXXXXXXX\kitaguchi\home\.vscode\extensions\aaron-bond.better-comments-2.1.0 -> aaron-bond.better-comments
    \\XXX-XXXXXXXXXXX\UserData-O\XXXXXXXXXX\kitaguchi\home\.vscode\extensions\hediet.vscode-drawio-1.4.0 -> hediet.vscode-drawio
    \\XXX-XXXXXXXXXXX\UserData-O\XXXXXXXXXX\kitaguchi\home\.vscode\extensions\kaiwood.endwise-1.4.2 -> kaiwood.endwise
    \\XXX-XXXXXXXXXXX\UserData-O\XXXXXXXXXX\kitaguchi\home\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.1 -> ms-vscode-remote.remote-ssh
    \\XXX-XXXXXXXXXXX\UserData-O\XXXXXXXXXX\kitaguchi\home\.vscode\extensions\ms-vscode-remote.remote-ssh-edit-0.65.1 -> ms-vscode-remote.remote-ssh-edit
    \\XXX-XXXXXXXXXXX\UserData-O\XXXXXXXXXX\kitaguchi\home\.vscode\extensions\ms-vscode.cpptools-1.2.2 -> ms-vscode.cpptools
    \\XXX-XXXXXXXXXXX\UserData-O\XXXXXXXXXX\kitaguchi\home\.vscode\extensions\ms-vscode.makefile-tools-0.2.0 -> ms-vscode.makefile-tools
    \\XXX-XXXXXXXXXXX\UserData-O\XXXXXXXXXX\kitaguchi\home\.vscode\extensions\rebornix.ruby-0.28.1 -> rebornix.ruby
    \\XXX-XXXXXXXXXXX\UserData-O\XXXXXXXXXX\kitaguchi\home\.vscode\extensions\redhat.vscode-yaml-0.16.0 -> redhat.vscode-yaml
    c:\VSCode\resources\app\extensions\configuration-editing -> vscode.configuration-editing
    c:\VSCode\resources\app\extensions\css-language-features -> vscode.css-language-features
    c:\VSCode\resources\app\extensions\debug-auto-launch -> vscode.debug-auto-launch
    c:\VSCode\resources\app\extensions\debug-server-ready -> vscode.debug-server-ready
    c:\VSCode\resources\app\extensions\emmet -> vscode.emmet
    c:\VSCode\resources\app\extensions\extension-editing -> vscode.extension-editing
    c:\VSCode\resources\app\extensions\git -> vscode.git
    c:\VSCode\resources\app\extensions\git-ui -> vscode.git-ui
    c:\VSCode\resources\app\extensions\github -> vscode.github
    c:\VSCode\resources\app\extensions\github-authentication -> vscode.github-authentication
    c:\VSCode\resources\app\extensions\grunt -> vscode.grunt
    c:\VSCode\resources\app\extensions\gulp -> vscode.gulp
    c:\VSCode\resources\app\extensions\html-language-features -> vscode.html-language-features
    c:\VSCode\resources\app\extensions\image-preview -> vscode.image-preview
    c:\VSCode\resources\app\extensions\jake -> vscode.jake
    c:\VSCode\resources\app\extensions\json-language-features -> vscode.json-language-features
    c:\VSCode\resources\app\extensions\markdown-language-features -> vscode.markdown-language-features
    c:\VSCode\resources\app\extensions\merge-conflict -> vscode.merge-conflict
    c:\VSCode\resources\app\extensions\microsoft-authentication -> vscode.microsoft-authentication
    c:\VSCode\resources\app\extensions\ms-vscode-remote.remote-wsl-recommender -> ms-vscode-remote.remote-wsl-recommender
    c:\VSCode\resources\app\extensions\ms-vscode.js-debug -> ms-vscode.js-debug
    c:\VSCode\resources\app\extensions\ms-vscode.js-debug-companion -> ms-vscode.js-debug-companion
    c:\VSCode\resources\app\extensions\ms-vscode.node-debug -> ms-vscode.node-debug
    c:\VSCode\resources\app\extensions\ms-vscode.node-debug2 -> ms-vscode.node-debug2
    c:\VSCode\resources\app\extensions\ms-vscode.references-view -> ms-vscode.references-view
    c:\VSCode\resources\app\extensions\ms-vscode.vscode-js-profile-table -> ms-vscode.vscode-js-profile-table
    c:\VSCode\resources\app\extensions\npm -> vscode.npm
    c:\VSCode\resources\app\extensions\php-language-features -> vscode.php-language-features
    c:\VSCode\resources\app\extensions\search-result -> vscode.search-result
    c:\VSCode\resources\app\extensions\simple-browser -> vscode.simple-browser
    c:\VSCode\resources\app\extensions\testing-editor-contributions -> vscode.testing-editor-contributions
    c:\VSCode\resources\app\extensions\typescript-language-features -> vscode.typescript-language-features

And same, realpathSync.native() and realpathSync() are different result for Z: drive...

> require('fs').realpathSync.native('C:\\VSCode')
< "C:\VSCode"
> require('fs').realpathSync('C:\\VSCode')
< "C:\VSCode"
> require('fs').realpathSync.native('Z:\\home')
< "\\XXX-XXXXXXXXXXX\UserData-O\XXXXXXXXXX\kitaguchi\home"
> require('fs').realpathSync('Z:\\home')
< "Z:\home"
shkit commented 3 years ago

I try insider build https://az764295.vo.msecnd.net/insider/edf387a2e8ffcec690d050c57dbc1f97c1b7169b/VSCode-win32-x64-1.55.0-insider.zip, and got same result.

jrieken commented 3 years ago

We have reached the bottom of this here: https://github.com/microsoft/vscode/issues/118562#issuecomment-797366389. Closing as duplicate

jrieken commented 3 years ago

Thanks everyone for the insights and trying. We will update the other issue with details about the fix

jrieken commented 3 years ago

/duplicate of https://github.com/microsoft/vscode/issues/118562

shkit commented 3 years ago

1.54.3 fixes my problem. Thank you!