vscode-powershell
vscode-powershell copied to clipboard
Prompted to update Powershell to non-LTS version even when $Env:POWERSHELL_UPDATECHECK is set to LTS
System Details
System Details Output
### VSCode version: 1.53.2 622cb03f7e070a9670c94bae1a45d78d7181fbd4 x64
### VSCode extensions:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
### PSES version: 2.3.0.0
### PowerShell version:
Name Value
---- -----
PSVersion 7.0.5
PSEdition Core
GitCommitId 7.0.5
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Description
I am experiencing a problem with... VS Code notifies as follows...
You have an old version of PowerShell (7.0.5). The current latest release is v7.1.2. Would you like to update the version? (This will close ALL pwsh terminals running in this Visual Studio Code session)
However I have set $Env:POWERSHELL_UPDATECHECK to "LTS" per https://docs.microsoft.com/en-us/powershell/scripting/whats-new/what-s-new-in-powershell-70?view=powershell-7.1#new-version-notification
Expected Behaviour
I'd expect the notification to only appear when updates to the LTS version of Powershell 7 are available. EG: 7.0.6.
Actual Behaviour
VS Code notifies as follows...
You have an old version of PowerShell (7.0.5). The current latest release is v7.1.2. Would you like to update the version? (This will close ALL pwsh terminals running in this Visual Studio Code session)
Attached Logs
Follow the instructions in the [troubleshooting docs](https://github.com/PowerShell/vscode-powershell/blob/master/docs/troubleshooting.md#logs vscode-powershell.zip vscode-powershell.zip
) about capturing and sending logs.
Do you get the update notification when you start pwsh.exe with that environment variable set?
No, it only seems to occur when the Powershell Integrated Console in VS Code starts up (which is every time I start VS Code). I can see that pwsh is started first, but no notification. Then the integrated console is started and the notification appears.
I was getting this notification in pwsh.exe before I set the environment variable a few weeks ago.
How/where are you setting the environment variable?
I have it set as a System variable (I vaguely recall running $Env:POWERSHELL_UPDATECHECK = 'LTS' in an elevated PS console).

Thanks @trolleyboy VSCode does not check for this variable when it runs its update mechanism, but this is a reasonable feature request to add a check for...thanks for catching and reporting this!
I am experiencing the same issue. VSCode tells me that the current latest release is v7.2.0. It does not mention that it is the preview version, rc1. It really should so that the user can make an informed decision.
https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-rc.1/PowerShell-7.2.0-rc.1-win-x64.msi

PS C:\Users\pwatson2> code --version
1.61.2
6cba118ac49a1b88332f312a8f67186f7f3c1643
x64
PS C:\Users\pwatson2> code --list-extensions --show-versions | Select-String -Pattern powershell
[email protected]
[email protected]
PS C:\Users\pwatson2> $PSVersionTable
Name Value
---- -----
PSVersion 7.1.5
PSEdition Core
GitCommitId 7.1.5
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
@Liturgist 7.2 is an LTS version, unless I'm missing something, this is as-expected. If it prompts you for 7.3.x when that chain starts, then there is a problem.
Also it's not the preview version as you stated, 7.2 LTS was released today as RTM.
I think this still might be misbehaving. Ideally if you're on an LTS it wouldn't prompt you to update to the "next LTS," just updates to your current LTS until it's out of support. Confirming now if the 7.2 update means 7.0 LTS Is no longer supported.
Yeah, 7.0 LTS isn't end-of-life until December 3, 2022, so while 7.2 is an LTS, in this case I do not think the update check should be prompting the user.
Closer examination of this issue is that it is still a feature request for the editor to respect this variable. But I agree with @Liturgist that this is a bug in PowerShell's update checker.
I almost filed a bug...but actually @Liturgist you're running a non-LTS, 7.1.5. So nevermind all I said! It is strange that the update is pointing you at an RC, I'm guessing this was a cache issue and it prompted you to update before the 7.2 release (non-RC) refreshed on GitHub.
I almost filed a bug...but actually @Liturgist you're running a non-LTS, 7.1.5. So nevermind all I said! It is strange that the update is pointing you at an RC, I'm guessing this was a cache issue and it prompted you to update before the 7.2 release (non-RC) refreshed on GitHub.
@andschwa, what steps can I take to remove this "cache issue?"
@andschwa so I agree the end-behavior (confirmed by tests) should be as such:
- If you are on an LTS, do not prompt to update your LTS until it is 30 days to EOS or something (how would we know? More info in the Powershell repo metadata.json?)
- If you are on non-LTS, prompt to always update to the latest, and if LTS is latest, then so be it.
@andschwa, what steps can I take to remove this "cache issue?"
It should be gone now!
(confirmed by tests)
Are you saying this is indeed working as intended @JustinGrote?
No I'm saying we should have tests to confirm that if we fix it :)
It took a while, but I got around to fixing this 😄