The Wayback Machine - https://web.archive.org/web/20201005204311/https://github.com/PowerShell/vscode-powershell/issues/2916
Skip to content
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

Execution policy should be checked client side before starting PowerShell Editor Services to prevent cryptic start issues #2916

Open
giojo81 opened this issue Aug 26, 2020 · 5 comments

Comments

@giojo81
Copy link

@giojo81 giojo81 commented Aug 26, 2020

Hello everyone,

I don't manage to execute the Console Preview, still the message "Unable to instantiate; language client undefined".
Even though I tried to see past issued, I coudn't manage to solve :(

If I install PowerShell 7.0 works correctly, but I will need to use 5.1 ones for project reasons.
ISE 5.1 is working fine, but.. VS code is another story!

Everything with latest version I'm afraid...

Here is what I get:

8/26/2020 12:16:16 PM [NORMAL] - Visual Studio Code v1.48.2 64-bit
8/26/2020 12:16:16 PM [NORMAL] - PowerShell Extension v2020.6.0
8/26/2020 12:16:16 PM [NORMAL] - Operating System: Windows 64-bit
8/26/2020 12:16:16 PM [NORMAL] - Language server starting --
8/26/2020 12:16:16 PM [NORMAL] -     PowerShell executable: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
8/26/2020 12:16:16 PM [NORMAL] -     PowerShell args: -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\en32071\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\en32071\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <=====
" -LogLevel 'Normal' -LogPath 'c:\Users\en32071\.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1598436976-ca22623e-8ae9-41d3-bea4-4d671b2ec2bb1598436975595\EditorServices.log' -SessionDetailsPath 'c:\Users\en32071\.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-12824-615781' -FeatureFlags @() 
8/26/2020 12:16:16 PM [NORMAL] -     PowerShell Editor Services args: Import-Module 'c:\Users\en32071\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2020.6.0' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\en32071\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules' -EnableConsoleRepl -StartupBanner "=====> PowerShell Integrated Console v2020.6.0 <=====
" -LogLevel 'Normal' -LogPath 'c:\Users\en32071\.vscode\extensions\ms-vscode.powershell-2020.6.0\logs\1598436976-ca22623e-8ae9-41d3-bea4-4d671b2ec2bb1598436975595\EditorServices.log' -SessionDetailsPath 'c:\Users\en32071\.vscode\extensions\ms-vscode.powershell-2020.6.0\sessions\PSES-VSCode-12824-615781' -FeatureFlags @() 
8/26/2020 12:16:16 PM [NORMAL] - powershell.exe started.
8/26/2020 12:16:16 PM [NORMAL] - Waiting for session file
8/26/2020 12:16:18 PM [NORMAL] - Session file found
8/26/2020 12:16:18 PM [NORMAL] - Registering terminal close callback
8/26/2020 12:16:18 PM [NORMAL] - Registering terminal PID log callback
8/26/2020 12:16:18 PM [NORMAL] - powershell.exe PID: 17780
8/26/2020 12:16:18 PM [NORMAL] - Language server started.
8/26/2020 12:16:18 PM [NORMAL] - {"status":"started","languageServiceTransport":"NamedPipe","languageServicePipeName":"\\\\.\\pipe\\PSES_tsmmuob5.tc3","debugServiceTransport":"NamedPipe","debugServicePipeName":"\\\\.\\pipe\\PSES_og2bai0c.qkl"}
8/26/2020 12:16:18 PM [NORMAL] - Connecting to language service on pipe \\.\pipe\PSES_tsmmuob5.tc3...
8/26/2020 12:16:18 PM [NORMAL] - Language service connected.
8/26/2020 12:17:20 PM [ERROR] - <ConsoleFeature>: Unable to instantiate; language client undefined.

Any idea?!

Thank you!

@rjmholt
Copy link
Member

@rjmholt rjmholt commented Aug 26, 2020

Hi @giojo81, do you have the other logs generated by the back-end of the extension? I'm not sure we can work out what's going on without them.

Also are any errors present in the terminal or on the screen?

@giojo81
Copy link
Author

@giojo81 giojo81 commented Aug 27, 2020

Dear @rjmholt , as soon as I've activated the mode

"powershell.developer.editorServicesLogLevel": "Diagnostic"

The console asked me this question.

=====> PowerShell Integrated Console v2020.6.0 <=====

Do you want to run software from this untrusted publisher?
File C:\Users\en32071\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules\PowerShellEditorServices\Commands\Public\Clear-Host.ps1 is published by CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US and is not trusted on your system. Only run scripts from trusted publishers.
[V] Never run [D] Do not run [R] Run once [A] Always run [?] Help (default is "Do not run"): A
PS C:\Users\en32071> 

I've answered A, then the SHELL started correctly.

Thank you very much for your suggestion and, as suggestion, could be interesting to prompt in some way the user in case there are blocking messages like this one.

Cheers!

@rjmholt
Copy link
Member

@rjmholt rjmholt commented Aug 27, 2020

I would have expected that prompt to occur without the diagnostic; it's a PowerShell prompt, not one we make ourselves. It seems that this is an execution policy issue

@TylerLeonhardt
Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Aug 27, 2020

It's odd to me as well that this prompt showed up when you set the log level to diagnostic. Can you provide the other logs @giojo81?

With that said, it would be nice if the vscode-powershell side could check for execution policy and warn users about this type of thing ahead of time.

@TylerLeonhardt TylerLeonhardt changed the title Unable to instantiate; language client undefined Execution policy should be checked client side before starting PowerShell Editor Services to prevent cryptic start issues Aug 27, 2020
@giojo81
Copy link
Author

@giojo81 giojo81 commented Aug 28, 2020

Dear @TylerLeonhardt , I can attach these other informations
1598516692-7d4ce1f5-9d13-4c10-baf8-2e1ab820017e1598516676631.zip

PS > code --list-extensions --show-versions

ms-vscode.powershell@2020.6.0
vscode-icons-team.vscode-icons@10.2.0
PS > $PSVersionTable


Name                           Value
----                           -----
PSVersion                      5.1.17763.1007
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.1007
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS > $psEditor.EditorServicesVersion


Major  Minor  Build  Revision
-----  -----  -----  --------
2      2      0      0

PS > code -v

1.48.2
a0479759d6e9ea56afa657e454193f72aef85bd0
x64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.