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

Extension should notify user when Constrained or Restricted language mode is enabled

Open ghost opened this issue 10 years ago • 5 comments

Please fill in these details so that we can help you!

System Details

  • Operating system name and version: Windows 10 Enterprise 64-bit (1607)
  • VS Code version: 1.5.1
  • PowerShell extension version: 0.7.2
  • Output from $PSVersionTable:
Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      5.1.14393.103                                                                           
PSEdition                      Desktop                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   10.0.14393.103                                                                          
CLRVersion                     4.0.30319.42000                                                                         
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1                                                                                 

Issue Description

Everytime when I open any PS script with VS Code and PS extension installed I get these errors:

Error: Could not start language service: undefined Error: Couldn't start client PowerShell Editor Services

1473484659-PowerShell.zip

Attached Logs

Follow the instructions in the README about capturing and sending logs.

ghost avatar Sep 10 '16 05:09 ghost

Hi @z442a9, it appears that your machine must have some policy set which enabled ConstrainedLanguage mode. This is preventing the language service from loading successfully.

Open a normal PowerShell prompt and run this line and let me know if the output is ConstrainedLanguage or RestrictedLanguage:

$ExecutionContext.SessionState.LanguageMode

You may have to talk to your administrator to see if this can be turned off for the PowerShell extension to work correctly. I'll add a warning message in the UI to notify the user that the extension won't work when this mode is turned on.

daviwil avatar Sep 12 '16 21:09 daviwil

Hi

When I run the command the output is: ConstrainedLanguage

ghost avatar Sep 13 '16 03:09 ghost

Hello, I see that this issue is still open but notification is already here for a long time for me in VS Code. Isn't it time to move to next step, i.e. removing the need for the message by supporting constrained mode like Powershell ISE does?

caparkaya avatar Jul 18 '18 11:07 caparkaya

Because we're not a native app (like the ISE), but instead a client/server, with the server being a PowerShell process running a module that hosts PowerShell execution, I suspect trying to implement this we'd have widespread problems with things like the whitelisted types (i.e. EditorServices is just an ordinary PowerShell module which uses non-whitelisted types for everything from just starting the host to creating the message transport channel, so getting it to start in ConstrainedLanguage mode would be a significant work item).

I'll see if I can do some investigating on the feasibility of this.

rjmholt avatar Jul 18 '18 16:07 rjmholt

Closing this in favor of #754

TylerLeonhardt avatar Oct 04 '18 21:10 TylerLeonhardt