Skip to content

vscode.env.shell might return empty string to extension if fetched very soon after startup #160694

@gjsjohnmurray

Description

@gjsjohnmurray

Type: Bug

Seems to be a timing issue. The following steps sometimes reproduce it for me, but success may depend on the performance of your workstation (mine is Windows) and which other extensions are enabled by default.

  1. Clone https://github.com/gjsjohnmurray/vscode-extension-samples/tree/show-160694
  2. Open the statusbar-sample folder in VS Code
  3. Open a Terminal in that folder and run npm install
  4. Switch to Debug view, choose the ONLY Extension configuration and run it. This launches with --disable-extensions
  5. When Extension Host window appears, look on the right of the status bar. If the repro was successful it will look like this:

image

If this doesn't happen, try the next steps:

  1. End debugging and launch the Extension configuration instead. This launches normally and probably won't trigger the problem:

image

  1. From Command Palette of the EH window, run Developer: Reload With Extensions Disabled. With luck this will cause the problem to happen (see first screenshot).

The extension activates "*", so immediately on startup. The first attempt to get vscode.env.shell happens from its activate method.

If the problem shows, click the status bar panel to get the value again. This time it should succeed.

VS Code version: Code - Insiders 1.72.0-insider (835ace5, 2022-09-12T05:16:16.290Z)
OS version: Windows_NT x64 10.0.22000
Modes:
Sandboxed: Yes

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions