microsoft / vscode

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

[Windows] Opening vscode by using "Recent Folders" will not load new environment variables #228351

Closed Lovenoreus closed 1 month ago

Lovenoreus commented 1 month ago

Type: Bug

Identify unexpected behaviour:

  1. On Windows make sure vscode is closed
  2. Now set new user-wide path environment variable to some binary like "Python.exe"
  3. Click "Start"-icon
  4. Search "vscode"
  5. Click on one of your projects under "Recent Folders"
  6. Now in vscode open integrated terminal and run the binary like "python"
  7. Recieve error that "python" is not recognized as command

Afterwards compare to normal behaviour:

  1. Now close the vscode window
  2. Click "Start"-icon
  3. Search "vscode"
  4. Click on the icon itself specifically to open vscode
  5. Now in vscode open integrated terminal and run the binary again
  6. Now things work, which shows that environment variables act unexpected and differently when opening vscode from "Recent Folders" which creates confusion.

I have disabled my extensions for this test manually.

VS Code version: Code 1.93.0 (4849ca9bdf9666755eb463db297b69e5385090e3, 2024-09-04T13:02:38.431Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i7-1255U (12 x 2611)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|undefined| |Memory (System)|31.71GB (21.91GB free)| |Process Argv|--crash-reporter-id 4aead221-41bd-46b7-8dec-bce2a7c2b59a| |Screen Reader|no| |VM|0%|
Extensions: none
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 g316j359:31013175 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 impr_priority:31102340 refactort:31108082 pythonrstrctxt:31112756 flightc:31134773 wkspc-onlycs-t:31132770 wkspc-ranged-t:31125599 cf971741:31134768 autoexpandse:31133494 ei213698:31121563 ```
Lovenoreus commented 1 month ago

I have tried multiple times to both start new integrated terminals and restarted vscode but still the environment variables (in my case i used user-wide path) will not load in the terminal as long as i open vscode from "Recent Folders"

bpasero commented 1 month ago

i am 99% sure this is either a bug in windows or expected behaviour, but nothing we can actually control. we do add to the recent list via electron APIs:

https://github.com/microsoft/vscode/blob/0b6e79d969b517756a5fa7f5564c63b1828cb5cf/src/vs/platform/workspaces/electron-main/workspacesHistoryMainService.ts#L374-L382

Leaving the issue for some days to see if someone has an idea, otherwise I would suggest to also report to Windows.

vs-code-engineering[bot] commented 1 month ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!