-
Notifications
You must be signed in to change notification settings - Fork 511
VSCode Extension v2022.8.5 initializes wrong user profile path #4202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hm...this may be an upstream problem with VS Code. As far as I can tell we're using the URIs and APIs correctly. We start with passing Line 124 in 3f98265
That's used to create the directory logging directory here: vscode-powershell/src/logging.ts Lines 137 to 147 in 3f98265
Which is both joining URIs (no conversion to file paths) and passing the URI to We then pass that URI to the server (what you see in the list of arguments): vscode-powershell/src/process.ts Line 54 in 3f98265
We explicitly use the @TylerLeonhardt any ideas? |
I would like to know the value of |
It's:
and
|
Sure but I'm just saying it could be the joinPath that's messing up... or maybe the |
After digging a little bit into it, it seems that the initially created session files are also not being created in the correct directory. The session files directory actually does not get created - however if I create the directory The extension then however still cannot access the session
The on the log-path that is created on the local hard drive two empty log files get created I'm attaching the files of the most recent startup attempt that do get created along with the output of the visual studio extension logs. local_hard_drive_session_file.zip Are the globalStorage paths evaluted differently during the extension startup? |
Yeah but these are both VS Code APIs 😆 I'll step through an extension startup on Windows later today and see what I can get you, though I don't have a UNC share so I'll have to set that up...somehow. Actually @Adwaenyth how the heck do you have a UNC path for AppData?! |
@andschwa The AppData folder can be redirected (and is in my case) via GPO ( Programs usually accept this fine. On occasion I've seen some installers struggle with that too, but main reason for that so far was having hardcoded directory paths like |
@Adwaenyth would you be able to debug in your environment and check the value of the variable @TylerLeonhardt asked about above? |
@andschwa @TylerLeonhardt to continue working on my project, I had had the group policy removed that enforced folder redirection for the I don't know when I'll get around to set up a test machine to reproduce the issue. All I can do atm is tell you the value the RegistryKey It might be different, if there's an actual drive letter mapped to that share instead of a UNC path. To setup folder redirection and offline files for user profile folders via Group Policy this article https://learn.microsoft.com/en-us/windows-server/storage/folder-redirection/deploy-folder-redirection is maybe a hint. PS: Since there were write actions to both the correct share name and the incorrect local hard drive folder, I'd think that in one place combining the path variable caused the issue, because I doubt that the value for Currently I'd suggest to avoid using folder redirection for AppData folder. |
Hello, I have the same problem. We use a virtual environment with redirect users folder to network folders (DFS). I tried install an older version of the PowerShell extension and version 2022.6.3 works correctly. All the newer versions has the same problem with interpretation of the URI path to log directory. |
Hi, I am having the same problem. |
This is a tough one to investigate without some concrete repro steps, unfortunately :( |
I'm working on getting these properties emitted by the logger! |
Ok @Adwaenyth, I added logs for the paths that are getting used here. Can you please update to v2022.11.0, enable diagnostic logging, and give us a fresh copy? Thanks! |
Seeing the same issue with PS 2022.11.0 11/20/2022 10:23:11 AM [NORMAL] - PowerShell Editor Services args: https://aka.ms/vscode-powershell Should be
We are also using redirected AppData(Roaming) folders via GPO. |
@confidentcyber can you please set logging to diagnostic and share your logs with us? |
Andy,
Please see redacted logs attached.
Very Respectfully,
Aaron Wallace
https://send.bitwarden.com/#g1UCzF_3BUGBOq9UAToSIQ/BJM1VqnD2U0fcHABC1lhbA
|
@confidentcyber Hm, I don't see anything attached! If you want to sift through them, I'm specifically look for the log lines that are like this, but filled in:
|
I attached it via email. Maybe this will work better. https://send.bitwarden.com/#g1UCzF_3BUGBOq9UAToSIQ/BJM1VqnD2U0fcHABC1lhbA |
@TylerLeonhardt for the log storage path
Its
As if the protocol And that sure seems to be the case! In VS Code's implementation:
It does not handle a UNC path unless the protocol is specifically |
Hello, last plugin version has the same error: It should be \ice.corp\users$\data\mjezek\AppData......... I don't know ho to enable diagnostic logging. Could you help me? |
@kiwi-ice can you please try the PowerShell Preview for VS Code? I pushed what I hope is a viable workaround for it, but don't currently have a test environment for this particular issue setup. |
@andschwa i think the issue here is that I've heard that @sandy081 @bpasero are likely the ones to talk to. tl;dr: the |
@andschwa the Powershell Preview works well. I tried one easy script and it works. But the terminal shows weird prompt: |
Hey @kiwi-ice that's #4279. We found out the hard way that VS Code's shell integration script didn't work for Windows PowerShell. We have actually fixed that both upstream and for the next preview, but for now you can use PowerShell 7 or disable Code's shell integration by setting |
@andschwa I have found out that on my disk C: is directory c:\users$\data\mjezek\AppData\Code\logs\ vith VSCode logs. I thing that it isn't right place to store my logs. They should be stored on my network folder. I use PowerShell Preview v2023.1.0 |
Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead. |
Prerequisites
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
Visual Studio Code Version
Extension Version
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 inC:\<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
The text was updated successfully, but these errors were encountered: