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

Prompted to update Powershell to non-LTS version even when $Env:POWERSHELL_UPDATECHECK is set to LTS

Open trolleyboy opened this issue 4 years ago • 16 comments

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.

trolleyboy avatar Mar 05 '21 00:03 trolleyboy

Do you get the update notification when you start pwsh.exe with that environment variable set?

rjmholt avatar Mar 05 '21 00:03 rjmholt

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.

trolleyboy avatar Mar 05 '21 01:03 trolleyboy

How/where are you setting the environment variable?

rjmholt avatar Mar 05 '21 02:03 rjmholt

I have it set as a System variable (I vaguely recall running $Env:POWERSHELL_UPDATECHECK = 'LTS' in an elevated PS console).

image

trolleyboy avatar Mar 05 '21 03:03 trolleyboy

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!

SydneyhSmith avatar Mar 09 '21 21:03 SydneyhSmith

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

image

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 avatar Nov 08 '21 17:11 Liturgist

@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.

JustinGrote avatar Nov 08 '21 18:11 JustinGrote

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.

andyleejordan avatar Nov 08 '21 22:11 andyleejordan

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.

andyleejordan avatar Nov 08 '21 22:11 andyleejordan

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.

andyleejordan avatar Nov 08 '21 22:11 andyleejordan

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.

andyleejordan avatar Nov 08 '21 22:11 andyleejordan

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?"

Liturgist avatar Nov 09 '21 19:11 Liturgist

@andschwa so I agree the end-behavior (confirmed by tests) should be as such:

  1. 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?)
  2. If you are on non-LTS, prompt to always update to the latest, and if LTS is latest, then so be it.

JustinGrote avatar Nov 09 '21 19:11 JustinGrote

@andschwa, what steps can I take to remove this "cache issue?"

It should be gone now!

andyleejordan avatar Nov 09 '21 19:11 andyleejordan

(confirmed by tests)

Are you saying this is indeed working as intended @JustinGrote?

andyleejordan avatar Nov 09 '21 19:11 andyleejordan

No I'm saying we should have tests to confirm that if we fix it :)

JustinGrote avatar Nov 09 '21 20:11 JustinGrote

It took a while, but I got around to fixing this 😄

andyleejordan avatar Dec 05 '22 21:12 andyleejordan