The Language Service Could not be started
The extension wont even load so I can't get the PSVersion. Everything was working fine until the update of the powershell extension.
Issue Description
The Language Service Could not be started
3/6/2020 8:24:21 AM [NORMAL] - Visual Studio Code v1.42.1 64-bit
3/6/2020 8:24:21 AM [NORMAL] - PowerShell Extension v2020.3.0
3/6/2020 8:24:21 AM [NORMAL] - Operating System: Windows 64-bit
3/6/2020 8:24:21 AM [NORMAL] - Language server starting --
3/6/2020 8:24:21 AM [NORMAL] - PowerShell executable: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
3/6/2020 8:24:21 AM [NORMAL] - PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\xxxxx\.vscode\extensions\ms-vscode.powershell-2020.3.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.3.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\xxxx\.vscode\extensions\ms-vscode.powershell-2020.3.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'c:\Users\xxxxxx\.vscode\extensions\ms-vscode.powershell-2020.3.0\logs\1583504661-d29ecc6e-241c-4f6d-a6ef-96dc719a4e801583504610369\EditorServices.log' -SessionDetailsPath 'c:\Users\xxxxxx\.vscode\extensions\ms-vscode.powershell-2020.3.0\sessions\PSES-VSCode-16792-972902' -FeatureFlags @()
3/6/2020 8:24:21 AM [NORMAL] - PowerShell Editor Services args: Import-Module 'c:\Users\xxxxx\.vscode\extensions\ms-vscode.powershell-2020.3.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.3.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\xxxxx\.vscode\extensions\ms-vscode.powershell-2020.3.0\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'c:\Users\michael.hagedorn\.vscode\extensions\ms-vscode.powershell-2020.3.0\logs\1583504661-d29ecc6e-241c-4f6d-a6ef-96dc719a4e801583504610369\EditorServices.log' -SessionDetailsPath 'c:\Users\xxxxx\.vscode\extensions\ms-vscode.powershell-2020.3.0\sessions\PSES-VSCode-16792-972902' -FeatureFlags @()
3/6/2020 8:24:21 AM [NORMAL] - powershell.exe started.
3/6/2020 8:24:21 AM [NORMAL] - Waiting for session file
3/6/2020 8:26:21 AM [NORMAL] - Error occurred retrieving session file
3/6/2020 8:26:21 AM [NORMAL] - Language server startup failed.
3/6/2020 8:26:21 AM [ERROR] - The language service could not be started:
3/6/2020 8:26:21 AM [ERROR] - Timed out waiting for session file to appear.
Name Value
---- -----
PSVersion 5.1.18362.628
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.628
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Everything was working fine until the update of the powershell extension.
This is at least a reasonable sign that it's some we might be able to fix. We've seen other issues like this where an OS update causes issues.
It looks like this is a session file issue but we don't log enough information to discern the problem. It might be available in VSCode's own logs (try the Developer: Show Logs option and pick Extension Host) or possibly in the developer tools console (available in the help menu -- looks like Chrome's dev tools console). Alternatively, if you install this build it should log the relevant information in the same log as the one you posted:
I'm glad it looks fixable. I've tried uninstalling/re-installing several times. Looks like it happened with the update for March. (I even tried installing an older version. Appreciate your help. Here's the log output from the above command:
[2020-03-06 13:56:12.488] [exthost] [info] extension host started
[2020-03-06 13:56:12.544] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"extensionId":{"value":"vscode.debug-auto-launch","_lower":"vscode.debug-auto-launch"},"activationEvent":"*"}
[2020-03-06 13:56:12.545] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/debug-auto-launch/dist/extension
[2020-03-06 13:56:12.554] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":true,"extensionId":{"value":"vscode.emmet","_lower":"vscode.emmet"},"activationEvent":"*"}
[2020-03-06 13:56:12.555] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/emmet/dist/extension
[2020-03-06 13:56:12.588] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.git","_lower":"vscode.git"},"activationEvent":"*"}
[2020-03-06 13:56:12.588] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/git/dist/main
[2020-03-06 13:56:12.634] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":true,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":"*"}
[2020-03-06 13:56:12.634] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/merge-conflict/dist/extension
[2020-03-06 13:56:12.641] [exthost] [info] ExtensionService#_doActivateExtension vscode.search-result {"startup":true,"extensionId":{"value":"vscode.search-result","_lower":"vscode.search-result"},"activationEvent":"*"}
[2020-03-06 13:56:12.641] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/search-result/dist/extension.js
[2020-03-06 13:56:12.645] [exthost] [info] ExtensionService#_doActivateExtension vscode.vscode-account {"startup":true,"extensionId":{"value":"vscode.vscode-account","_lower":"vscode.vscode-account"},"activationEvent":"*"}
[2020-03-06 13:56:12.645] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/vscode-account/dist/extension.js
[2020-03-06 13:56:12.651] [exthost] [info] eager extensions activated
The application hangs as soon as I install the powershell ext so I have to keep it disabled. -FYI

Here's the log output from the above command:
Hmmm, I don't see anything of use in there (unfortunately VSCode's own logs are quite opaque).
Could you try installing the (zipped) VSIX I linked above? Can do it like this:
expand-archive ./psvsix.zip ./psext.vsix
code --install-extension ./psext.vsix
You'll then need to disable the PowerShell extension (because the VSIX is a "PowerShell Preview" extension) and restart VSCode.
Hopefully that will log the reason for startup failure.
The hang you're seeing may well be https://github.com/PowerShell/vscode-powershell/issues/2377, which is a VSCode bug we're still waiting on a fix for.
I dont see the link. The hang is more when the extension is trying to be loaded, that's what happens. Please let me know how to get the VSIX. I need to get up and running asap. thanks
I've already tried the Powershell preview ext and get the same behavior.
The link is in this comment: https://github.com/PowerShell/vscode-powershell/issues/2526#issuecomment-595916638
I started seeing the same issue today, possibly right after VSCode autoupdated. If I run the launch command from a regular command prompt here's the error I get;
Import-Module : The module manifest 'C:\Users\ad_jcphilli\.vscode\extensions\ms-vscode.powershell-2020.3.0\modules\Powe
rShellEditorServices\PowerShellEditorServices.psd1' could not be processed because it is not a valid Windows
PowerShell restricted language file. Remove the elements that are not permitted by the restricted language:
At C:\Users\ad_jcphilli\.vscode\extensions\ms-vscode.powershell-2020.3.0\modules\PowerShellEditorServices\PowerShellEdi
torServices.psd1:12 char:18
+ RootModule = if ($PSEdition -eq 'Core')
+ ~~~~~~~~~~
A variable that cannot be referenced in restricted language mode or a Data section is being referenced. Variables that
can be referenced include the following: $PSCulture, $PSUICulture, $true, $false, and $null.
At line:1 char:1
+ Import-Module 'c:\Users\ad_jcphilli\.vscode\extensions\ms-vscode.powershell-2020 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\Users\ad_jcp...orServices.psd1:String) [Import-Module], Missing
MemberException
+ FullyQualifiedErrorId : Modules_InvalidManifest,Microsoft.PowerShell.Commands.ImportModuleCommand
Start-EditorServices : The term 'Start-EditorServices' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:151
+ ... ervices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostPro ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Start-EditorServices:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
@rjmholt Where do I place the psvsix.zip so code can unzip and install?
After a little more investigation I think the issue might be the use of $PSEdition in .vscode\extensions\ms-vscode.powershell-2020.3.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1
According to this source;
By default, only the following variables are permitted in RestrictedLanguage mode:
$PSCulture $PSUICulture $True $False $Null Module manifests, which use RestrictedLanguage mode, permit the following additional variables as well:
$PSScriptRoot $PSEdition (in PowerShell Core) $EnabledExperimentalFeatures (in PowerShell Core)
I am not using PowerShell Core;
Name Value
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 6.3.9600.19170
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
That said, when I change line 12 of the psd1 from
RootModule = if ($PSEdition -eq 'Core')
{
'bin/Core/Microsoft.PowerShell.EditorServices.Hosting.dll'
}
else
{
'bin/Desktop/Microsoft.PowerShell.EditorServices.Hosting.dll'
}
to
RootModule = 'bin/Desktop/Microsoft.PowerShell.EditorServices.Hosting.dll'
I don't see the error but the terminal window displays the text below but never finishes loading.
=====> PowerShell Integrated Console <=====
Where do I place the psvsix.zip so code can unzip and install?
@spidey323 You need to unzip it yourself and then install the VSIX in code or through PowerShell.
Try running this in PowerShell:
expand-archive ./psvsix.zip ./psext.vsix
code --install-extension ./psext.vsix
PSVersion 4.0
@happywino you're using PowerShell 4, which the PowerShell extension no longer supports.
Even changing the manifest, PSES won't load properly because PSReadLine does not support PowerShell 4.
The $PSEdition variable in manifests is permitted from PS 5.1.
Ouch, so what version of the extension should I install and use given I have no control of the powershell version installed on my environment?
On Fri, Mar 6, 2020, 4:52 PM Robert Holt [email protected] wrote:
PSVersion 4.0
@happywino https://github.com/happywino you're using PowerShell 4, which the PowerShell extension no longer supports https://github.com/PowerShell/vscode-powershell/issues/1310
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PowerShell/vscode-powershell/issues/2526?email_source=notifications&email_token=ADRA3LTFZKMO7VINL2R4V2DRGGLEBA5CNFSM4LDF2SYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEODJQYI#issuecomment-596023393, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRA3LWRYSKTVFOY2JZPZITRGGLEBANCNFSM4LDF2SYA .
In the extensions pane click on the gear:
Then click "Install another version..."
and choose the one right before the last one.
That said...
I would highly recommend pushing on those that do have control to upgrade to Windows PowerShell 5.1 (in-place upgrade)...
or better yet, go get PowerShell 7 which is a side-by-side install with Windows PowerShell and has the best experience with the vscode extension.
Guys, I noticed that the PowerShell extension was giving an error when opening a .ps1 file, so I uninstalled it, closed vscode and tried to install again, I couldn't, now it's not possible to install, see the generated log. VSIXInstaller_0b284ba3-a28e-4f61-a104-2a0db64c4bd2.log

@rjmholt : This appears to be an issue. Do we wait for a fix or what's the next action plan?
Can you also attach the logs for the PowerShell extension here so we can get a better idea of what's going on?
Please make sure you enable Diagnostic logging:
"powershell.developer.editorServicesLogLevel": "Diagnostic"
1583783706-7a4eb4ff-6b52-4f10-809c-1f499e45a07d1583783704111.zip I too can reproduce this although there isn't much in the logs despite turning on the diagnostic logging.