vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

Starting Code results in "PowerShell language features are disabled due to an unsupported LanguageMode: ConstrainedLanguage" message

Open johnnyreilly opened this issue 9 years ago • 4 comments

Raising here after being directed to here: https://github.com/Microsoft/vscode/issues/33143

  • VSCode Version: Code 1.15.1 (41abd21afdf7424c89319ee7cb0445cc6f376959, 2017-08-16T18:07:25.676Z)
  • OS Version: Windows_NT x64 6.1.7601
  • Extensions:
Extension Author (truncated) Version
tslint eg2 0.17.0
csharp ms- 1.12.1
PowerShell ms- 1.4.1
vscode-docker Pet 0.0.16
vscode-icons rob 7.12.0
shell-launcher Tyr 0.1.3

Steps to Reproduce:

  1. Start up Code
  2. Open up the Terminal
  3. Observe "PowerShell language features are disabled due to an unsupported LanguageMode: ConstrainedLanguage" error

If you look at the logs you see this:

[10:58:54] Language server starting...
powershell.exe started --
    pid: 11060
    exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
    args: C:\Users\jreilly\.vscode\extensions\ms-vscode.powershell-1.4.1\scripts\Start-EditorServices.ps1 -EditorServicesVersion '1.4.1' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '1.4.1' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'C:\Users\jreilly\.vscode\extensions\ms-vscode.powershell-1.4.1\modules' -EnableConsoleRepl -LogLevel 'Normal' -LogPath 'C:\Users\jreilly\.vscode\extensions\ms-vscode.powershell-1.4.1\logs\1503655134-00c42217-4248-45b7-a606-46f526fd4a5a1503655127754\EditorServices.log' -SessionDetailsPath 'C:\Users\jreilly\.vscode\extensions\ms-vscode.powershell-1.4.1\sessions\PSES-VSCode-3976-523561' -FeatureFlags @()


PowerShell language features are disabled due to an unsupported LanguageMode: ConstrainedLanguage

powershell.exe terminated or terminal UI was closed

Interestingly, I have my terminal configured using userSettings.json:

    "terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",

And I can open those terminals just fine. Note that the erroring version is using a different exe: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe.

Can we configure the integrated to use the sysnative version as well? Would that solve the problem?

johnnyreilly avatar Aug 25 '17 22:08 johnnyreilly

You're getting this error because we don't support ConstrainedLanguage mode at the moment. Open powershell.exe, run this code and see what it returns: $host.Runspace.LanguageMode

The terminal.integrated.shell.windows setting is for VS Code's default Integrated Terminal experience, it doesn't have an effect on the PowerShell extension.

daviwil avatar Aug 25 '17 22:08 daviwil

Hello,

Is there a roadmap for Powershell extension to support "Constrained Language Mode"? Because Powershell_ISE supports language features even in constrained language mode. Because many developers are working inside organizations which naturally use AppLocker policies for security, which enforces Constrained Language Mode, which removes many advantages of using VS Code for powershell development..

Kind Regards

caparkaya avatar Jul 18 '18 11:07 caparkaya

Closing this in favor of #754.

TylerLeonhardt avatar Oct 04 '18 21:10 TylerLeonhardt

I experienced this issue after installing the Powershell extension. I was able to work around it by launching VS Code as admin.

cbrookins avatar Oct 08 '18 14:10 cbrookins