Shows the error message when opening a PowerShell script

The language service could not be started: Source: PowerShell (Extension)

Earlier today when opening a PowerShell script in Visual Studio Code I got the following error message:

The language service could not be started:

Source: PowerShell (Extension)

After some investigation that included changing the Editor Services log level to Diagnostic, and decoding the base64 encoded command being passed to pwsh, it was pointed out to me on GitHub that PowerShell versions prior to 7 contain a bug that, when they’re installed as a .NET Core global tool, prevents them from processing parameters passed to the pwsh command.

So just to confirm the version I had installed, I ran…

$ dotnet tool list -g

 Package Id      Version      Commands
 powershell      6.2.3        pwsh  

… and then after closing opened instances of Visual Studio Code, I updated PowerShell using .NET Core’s CLI:

$ dotnet tool update powershell -g

Tool 'powershell' was successfully updated from version '6.2.3' to version '7.0.0'.

In case you didn’t install PowerShell through .NET Core’s CLI, you may want to take a look at “Installing various versions of PowerShell” over on Microsoft Docs where you’ll find instructions for installing PowerShell on all the supported target platforms.

Published by

Alfred Myers

I have been interested in computers since I got my hands on a magazine about digital electronics back in 1983 and programming them has been paying the bills since 1991. Having focused on Microsoft-centric technology stacks for the best part of two decades, in recent years I’ve been educating myself on open source technologies such as Linux, networking and the open web platform.

One thought on “The language service could not be started: Source: PowerShell (Extension)”

Comments are closed.