Description
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
Issue:
Cannot execute PowerShell scripts with PowerShell Extension v2022.11.0 after the latest upgrade. Standalone commands run fine in the Terminal window but scripts open will not execute. After reading through the logs I discovered the following workaround which has fixed the issue.
Workaround- Install the psscriptanalyzer module:
install-module psscriptanalyzer -force -scope AllUsers
Error message:
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', 'Import-Module 'c:\Users\xxxxxxx.vscode\extensions\ms-vscode.powershell-2022.11.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2022.11.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\xxxxxxx.vscode\extensions\ms-vscode.powershell-2022.11.0\modules' -EnableConsoleRepl -StartupBanner "PowerShell Extension v2022.11.0
Copyright (c) Microsoft Corporation.
https://aka.ms/vscode-powershell
Type 'help' to get help.
" -LogLevel 'Normal' -LogPath 'c:\Users\xxxxxxx\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\1669041740-cc28b74a-49e7-4f2c-9e4b-db582deda4051669041688081\EditorServices.log' -SessionDetailsPath 'c:\Users\xxxxxxx\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-1372-299504.json' -FeatureFlags @() '" terminated with exit code: 1.
vscode-powershell.log
11/21/2022 9:42:20 AM [NORMAL] - PowerShell Extension v2022.11.0
11/21/2022 9:42:20 AM [NORMAL] - powershell.exe started.
11/21/2022 9:42:22 AM [NORMAL] - Session file found!
11/21/2022 9:42:22 AM [NORMAL] - Session details: {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\.\pipe\PSES_kmvut4z3.cbi","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\.\pipe\PSES_blhdox0v.t1d"}
11/21/2022 9:42:47 AM [ERROR] - The PowerShell Extension Terminal has stopped, would you like to restart it? IntelliSense and other features will not work without it!
11/21/2022 9:53:18 AM [NORMAL] - Terminating PowerShell process...
11/21/2022 9:53:18 AM [NORMAL] - Waiting for session file...
11/21/2022 9:53:20 AM [NORMAL] - Session file found!
11/21/2022 9:53:20 AM [NORMAL] - Language service socket connected.
EditorServices.log
System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2)
at Microsoft.PowerShell.EditorServices.Services.WorkspaceService.ResolveRelativeScriptPath(String baseFilePath, String relativePath)
2022-11-21 09:42:27.243 -05:00 [INF] Unable to find PSSA settings file at 'PSScriptAnalyzerSettings.psd1'. Loading default rules.
2022-11-21 09:42:27.243 -05:00 [INF] PSScriptAnalyzer settings file not found. Falling back to default rules
2022-11-21 09:53:22.729 -05:00 [INF] ReadLine overridden with 'Microsoft.PowerShell.EditorServices.Services.PowerShell.Console.PsrlReadLine'
2022-11-21 09:53:24.502 -05:00 [WRN] No ConfigurationItems have been defined, configuration won't surface any configuration from the client!
2022-11-21 09:53:24.542 -05:00 [ERR] Could not resolve Script Analyzer settings path due to null or empty workspaceRootPath.
2022-11-21 09:53:25.371 -05:00 [ERR] Could not resolve relative script path
baseFilePath =
relativePath = PSScriptAnalyzerSettings.psd1
PowerShell Version
Name Value
---- -----
PSVersion 5.1.22000.832
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22000.832
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Visual Studio Code Version
1.73.1
6261075646f055b99068d3688932416f2346dd3b
x64
Extension Version
ms-vscode.powershell@2022.11.0
Steps to Reproduce
Currently this issue only appears on systems that had Code installed that then upgraded to the latest version of the PowerShell extension.
Visuals
No response
Logs
No response