Skip to content

Better error message when using unsupported PowerShell #4521

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
4 of 6 tasks
saeedt2 opened this issue Apr 16, 2023 · 8 comments · Fixed by #4532
Closed
4 of 6 tasks

Better error message when using unsupported PowerShell #4521

saeedt2 opened this issue Apr 16, 2023 · 8 comments · Fixed by #4532
Assignees
Labels
Area-Tech Debt Issues for Tech Debt Days! Issue-Bug A bug to squash.

Comments

@saeedt2
Copy link

saeedt2 commented Apr 16, 2023

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

I am getting this error every time I start VS code
4/16/2023 1:10:06 PM [NORMAL] - pwsh.exe started.

4/16/2023 1:10:06 PM [NORMAL] - Waiting for session file...

4/16/2023 1:10:36 PM [WARNING] - Loading the PowerShell extension is taking longer than expected. If you're using privilege enforcement software, this can affect start up performance.

4/16/2023 1:14:08 PM [NORMAL] - Timed out waiting for session file to appear!

4/16/2023 1:14:08 PM [ERROR] - PowerShell process failed to start:

4/16/2023 1:14:08 PM [ERROR] - Timed out waiting for session file to appear!

4/16/2023 1:14:08 PM [ERROR] - Unknown session status 'undefined' with reason 'undefined

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.1.4
PSEdition                      Core
GitCommitId                    7.1.4
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

[email protected]

1.77.3
704ed70d4fd1c6bd6342c436f1ede30d1cff4710
x64

Extension Version

Steps to Reproduce

the error is produced at each start of Visual studio Code, both by standard or run as admin. Tried to uninstall extension and reinstall. does not fix
get this error
The terminal process "C:\Program Files\PowerShell\7\pwsh.exe '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', 'Import-Module 'c:\Users\ahmads.vscode\extensions\ms-vscode.powershell-2023.3.3\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2023.3.3' -AdditionalModules @('PowerShellEditorServices.VSCode') -BundledModulesPath 'c:\Users\ahmads.vscode\extensions\ms-vscode.powershell-2023.3.3\modules' -EnableConsoleRepl -StartupBanner "PowerShell Extension v2023.3.3 Copyright (c) Microsoft Corporation. https://aka.ms/vscode-powershell Type 'help' to get help. " -LogLevel 'Normal' -LogPath 'c:\Users\ahmads\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\1681614605-ae62c778-393e-45ea-aa23-844718bebce11681614602721\EditorServices.log' -SessionDetailsPath 'c:\Users\ahmads\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSC...

Visuals

image

Logs

No response

@saeedt2 saeedt2 added the Issue-Bug A bug to squash. label Apr 16, 2023
@ghost ghost added the Needs: Triage Maintainer attention needed! label Apr 16, 2023
@JustinGrote
Copy link
Collaborator

Do you potentially have a profile configured? Does it open normally otherwise?

@saeedt2
Copy link
Author

saeedt2 commented Apr 17, 2023

Thanks for reaching out to me.
Don't think I have a profile setup. I do not get prompt to chose profile when I open VS-Code. I get error every time I open VSCode .When I go to Cont+Shift+P and type profile and select show profile, I see settings.jason with following contents
{
"workbench.colorTheme": "Default Dark+",
"files.autoSave": "afterDelay",
"workbench.editor.untitled.hint": "hidden",
"editor.fontFamily": "Fira Code",
"editor.minimap.enabled": false
}

@JustinGrote
Copy link
Collaborator

I meant your powershell profile. If you open powershell and type gc $profile.currentuserallhosts, does anything come up?

@saeedt2
Copy link
Author

saeedt2 commented Apr 17, 2023

HI Justine. this is the output of the profile command
running the cmmand I get this output ( I have replaced my login name with XXXX )
PS U:> gc $profile.currentuserallhosts
gc : Cannot find path 'C:\Users\XXXXX\OneDrive - XXXXX\Documents\WindowsPowerShell\profile.ps1' because it does not exist.
At line:1 char:1

  • gc $profile.currentuserallhosts
  •   + CategoryInfo          : ObjectNotFound: (C:\Users\XXXXX...ell\profile.ps1:String) [Get-Content], ItemNotFoundException
      + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
    

@JustinGrote
Copy link
Collaborator

OK just checking. It's not common for PowerShell to lock up, however I noticed your current verson is 7.1.4. That version is out of support. You may want to try the latest 7.2 or 7.3, there may be bugfixes that resolve the issue.
https://learn.microsoft.com/en-us/powershell/scripting/install/powershell-support-lifecycle?view=powershell-7.3

@SydneyhSmith SydneyhSmith changed the title the PowerShell extension is taking longer than expected. If you're using privilege enforcement software, this can affect start up performance. Better error message when using unsupported PowerShell Apr 18, 2023
@SydneyhSmith SydneyhSmith added the Area-Tech Debt Issues for Tech Debt Days! label Apr 18, 2023
@andyleejordan
Copy link
Member

Ah, this is similar to #4371. Deprecated versions of PowerShell (such as 6.x and 7.1) will fail to load the module (because since they're deprecated the module isn't compatible with their out-of-date versions of .NET). Unfortunately, our error messaging around this is poor, and as we identified in that last issue we should say "hey! You're using 6.x or 7.1, you need to update" instead of this "undefined" message. That's on me, I'll get to it this week!

@saeedt2
Copy link
Author

saeedt2 commented Apr 25, 2023 via email

@andyleejordan
Copy link
Member

Way better error handling for this in the works too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Tech Debt Issues for Tech Debt Days! Issue-Bug A bug to squash.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants