Vscode-powershell: PowerShell extension for VSCode will not load

Created on 4 Jan 2018  路  10Comments  路  Source: PowerShell/vscode-powershell

System Details

  • Operating system name and version: Windows 10
  • VS Code version: 1.19.1
  • PowerShell extension version: 1.5.1
  • Output from $PSVersionTable:
Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

`code -v
1.19.1
0759f77bb8d86658bc935a10a64f6182c5a1eeba
x64
`

`
$pseditor.EditorServicesVersion = $null
`

`
code --list-extensions --show-versions
[email protected]
[email protected]
[email protected]
`

`
Name                           Value
----                           -----
PSVersion                      5.1.16299.98
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.98
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
`

Issue Description

I am experiencing a problem with loading the powershell extension.

image

Attached Logs

The following output is from the Output tab in vscode.
1/4/2018 10:38:52 AM [NORMAL] - Visual Studio Code v1.19.1 64-bit 1/4/2018 10:38:52 AM [NORMAL] - PowerShell Extension v1.5.1 1/4/2018 10:38:52 AM [NORMAL] - Operating System: Windows 64-bit 1/4/2018 10:38:52 AM [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path. 1/4/2018 10:38:52 AM [NORMAL] - Language server starting -- 1/4/2018 10:38:52 AM [NORMAL] - exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe 1/4/2018 10:38:52 AM [NORMAL] - args: C:\Users\janedoe\.vscode\extensions\ms-vscode.powershell-1.5.1\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.5.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\janedoe\.vscode\extensions\ms-vscode.powershell-1.5.1\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\janedoe\.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1515080332-33a658fc-f020-4fa6-ae2b-a07134fea8cc1515080329234\EditorServices.log' -SessionDetailsPath 'C:\Users\janedoe\.vscode\extensions\ms-vscode.powershell-1.5.1\sessions\PSES-VSCode-2232-888000' -FeatureFlags @() 1/4/2018 10:38:52 AM [NORMAL] - powershell.exe started, pid: 12516 1/4/2018 10:39:52 AM [NORMAL] - Language server startup failed. 1/4/2018 10:39:52 AM [ERROR] - The language service could not be started: 1/4/2018 10:39:52 AM [ERROR] - Timed out waiting for session file to appear. 1/4/2018 10:43:53 AM [NORMAL] - powershell.exe terminated or terminal UI was closed

All 10 comments

Hi Chris,

Did you turn on verbose logging as per https://github.com/PowerShell/vscode-powershell#reporting-problems ?

Yes. This is all that is in the log file, even with verbose logging on. It's the same as what I posted above.

1/4/2018 12:46:15 PM [NORMAL] - Path specified by 'powerShellExePath' setting - '' - not found, reverting to default PowerShell path. 1/4/2018 12:46:15 PM [NORMAL] - Language server starting -- 1/4/2018 12:46:15 PM [NORMAL] - exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe 1/4/2018 12:46:15 PM [NORMAL] - args: C:\Users\janedoe\.vscode\extensions\ms-vscode.powershell-1.5.1\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.5.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\janedoe\.vscode\extensions\ms-vscode.powershell-1.5.1\modules' -EnableConsoleRepl -LogLevel 'Verbose' -LogPath 'C:\Users\janedoe\.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1515087975-b621d3cd-86a9-4b66-81b2-3654e17b28af1515087971616\EditorServices.log' -SessionDetailsPath 'C:\Users\janedoe\.vscode\extensions\ms-vscode.powershell-1.5.1\sessions\PSES-VSCode-6452-943314' -FeatureFlags @() 1/4/2018 12:46:16 PM [NORMAL] - powershell.exe started, pid: 3912 1/4/2018 12:47:15 PM [NORMAL] - Language server startup failed. 1/4/2018 12:47:15 PM [ERROR] - The language service could not be started: 1/4/2018 12:47:15 PM [ERROR] - Timed out waiting for session file to appear.

I don't get an EditorServices.log file

It appears as though there is an issue starting the PowerShell Editor Services. I found the command that is failing and ran it manually with -Verbose and this is the output I got.

[...de.powershell-1.5.1\scripts> .\Start-EditorServices.ps1 -EditorServicesVersion '1.5.1' -HostName 'Visual Studio Code
 Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.5.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -B
undledModulesPath 'C:\Users\Chris Sommer\.vscode\extensions\ms-vscode.powershell-1.5.1\modules' -EnableConsoleRepl -LogL
evel 'Verbose' -LogPath 'C:\Users\Chris Sommer\.vscode\extensions\ms-vscode.powershell-1.5.1\logs\1515087975-b621d3cd-86
a9-4b66-81b2-3654e17b28af1515087971616\EditorServices.log' -SessionDetailsPath 'C:\Users\Chris Sommer\.vscode\extensions
\ms-vscode.powershell-1.5.1\sessions\PSES-VSCode-6452-943314' -FeatureFlags @() -Verbose
VERBOSE: Populating RepositorySourceLocation property for module PowerShellGet.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.1.3.2\PSModule.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1'.
VERBOSE: Loading module from path 'C:\Users\janedoe\.vscode\extensions\ms-vscode.powershell-1.5.1\modules\PowerShellEditorServices\PowerShellEditorServices.psm1'.
VERBOSE: Loading module from path 'C:\Users\janedoe\.vscode\extensions\ms-vscode.powershell-1.5.1\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'.
VERBOSE: Importing function 'Compress-LogDir'.
VERBOSE: Importing function 'Get-PowerShellEditorServicesVersion'.
VERBOSE: Importing function 'Start-EditorServicesHost'.


An error occurred while starting PowerShell Editor Services:

Cannot index into a null array.
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exc
eption)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

This is a bit confusing. You specify paths in C:\Users\************ to the Start-EditorServices.ps1 script but the command winds up importing PSES from C:\Users\janedoe. What is your $env:PSModulePath set to?

Actual path is C:\Users\Chris Sommer. I was replacing that with janedoe to try to hide my actual username but forgot to change it in that last snippet.

My $env:PSModulePath is correct.

C:\Users\Chris Sommer\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32
\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\PowerShell\Modules\;C:\Program Fil
es (x86)\AWS Tools\PowerShell\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\

Doh!

BTW can you try that command again and after it fails, look at $error to see what it lists. For each error, run it through: $error[0].Exception | fl -force * (adjust the 0 to match the index). If any error has InnerException set, then list those too with $error[0].Exception.InnerException | fl -force *. Post that info back here. Thanks.

I uninstalled and reinstalled VSCode again, along with the PowerShell extension and everything is now working. Must have been something on my local machine, but I have no idea what that was. I'm just happy to have it working again.

This has been an interesting adventure. Thanks again for the help.

Was this page helpful?
0 / 5 - 0 ratings