Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
johnnyreilly opened this issue Aug 25, 2017 · 4 comments

Comments

@johnnyreilly
Copy link

Raising here after being directed to here: microsoft/vscode#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?

@daviwil
Copy link
Contributor

daviwil commented Aug 25, 2017

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.

@caparkaya
Copy link

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

@TylerLeonhardt
Copy link
Member

Closing this in favor of #754.

@cbrookins
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants