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.

VSCode Extension v2022.8.5 initializes wrong user profile path

See original GitHub issue

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

On a system with folder redirection for $env:AppData Folder to a UNC Path, the PowerShell extension does not resolve that path correctly on startup.

PowerShell Version

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

code --version
1.72.0
64bbfbf67ada9953918d72e1df2f4d8e537d340e
x64

Extension Version

code --list-extensions --show-versions | select-string powershell

ms-vscode.powershell@2022.8.5

Steps to Reproduce

The Extension creates the initial session files in C:\<shareName>\<UserName>\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-<ID>.json and the intial log Folders in C:\<shareName>\<UserName>\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\<RandomID> on the local harddrive.

After creating these files however, the extension tries to use at least the log files from the UNC share (which aren’t present there) and creates a partial log for the respective session in \\<ServerName>\<ShareName>\<UserName>\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\<RandomID>.

The initial call from the VS Code Terminal Console invokes a scriptblock like this : Import-Module 'c:\Users\<UserName>\.vscode\extensions\ms-vscode.powershell-2022.8.5\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2022.8.5' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\<UserName>\.vscode\extensions\ms-vscode.powershell-2022.8.5\modules' -EnableConsoleRepl -StartupBanner "<BannerText>" -LogLevel 'Normal' -LogPath '\<ShareName>\<UserName>\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\<RandomID>\EditorServices.log' -SessionDetailsPath '\<ShareName>\<UserName>\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-<ID>.json' -FeatureFlags @()

Instead of what I believe would be correct:

Import-Module 'c:\Users\<UserName>\.vscode\extensions\ms-vscode.powershell-2022.8.5\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2022.8.5' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\<UserName>\.vscode\extensions\ms-vscode.powershell-2022.8.5\modules' -EnableConsoleRepl -StartupBanner "<BannerText>" -LogLevel 'Normal' -LogPath '\\<ServerName>\<ShareName>\<UserName>\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\<RandomID>\EditorServices.log' -SessionDetailsPath '\\<ServerName>\<ShareName>\<UserName>\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-<ID>.json' -FeatureFlags @()

Visuals

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:25 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
TylerLeonhardtcommented, Nov 23, 2022

@andschwa i think the issue here is that vscode-userdata is used for UNC file paths when it probably shouldn’t (since UNC paths are just normal file: paths).

I’ve heard that @sandy081 @bpasero are likely the ones to talk to.

tl;dr: the vscode-userdata scheme is being used for the global storage URI when that uses a UNC path.

1reaction
andschwacommented, Nov 2, 2022

I’m working on getting these properties emitted by the logger!

Read more comments on GitHub >

github_iconTop Results From Across the Web

User and Workspace Settings - Visual Studio Code
To open the Settings editor, use the following VS Code menu command: On Windows/Linux - File > Preferences > Settings; On macOS -...
Read more >
Managing Extensions in Visual Studio Code
Extensions are installed in a per user extensions folder. Depending on your platform, the location is in the following folder: Windows %USERPROFILE%\.vscode\ ...
Read more >
Terminal Profiles in Visual Studio Code
Terminal profiles are platform-specific shell configurations comprised of an executable path, arguments, and other customizations.
Read more >
Troubleshoot Terminal launch failures - Visual Studio Code
Below are specific troubleshooting steps, if the user guide hasn't helped you ... apply to all platforms that support VS Code; macOS, Linux,...
Read more >
Visual Studio Code Frequently Asked Questions
By default, VS Code is set up to auto-update for macOS and Windows users when ... To learn why Visual Studio Code, the...
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