`winget upgrade --include-pinned` does not include pinned packages
Brief description of your issue
Winget upgrade reports that packages have pins preventing upgrade. Running the command again with --include-pinned does not show any additional results, despite me knowing for a fact that at least one pinned package has an upgrade available.
Steps to reproduce
Ensure a package reports that it is available for upgrade, such as Microsoft.Office
Pin the package
Run winget upgrade - Note that the message indicating pinned packages are present for upgrade is shown
Run winget upgrade --include-pinned - Note that the pinned package is still not shown
Expected behavior
Packages with pins to be shown for upgrade when --include-pinned is used
Actual behavior
Upgrade - WinGet-2023-02-15-20-54-39.452.log Upgrade include Pinned - WinGet-2023-02-15-20-54-59.275.log List Windows SDK - WinGet-2023-02-15-20-55-32.447.log List Office - WinGet-2023-02-15-20-55-55.297.log
PS C:\WINDOWS\system32> winget upgrade
Name Id Version Available Source
-----------------------------------------------------------------------------------------------------------------------
CCleaner Piriform.CCleaner 6.08 6.08.10255 winget
Git Git.Git 2.39.1 2.39.2 winget
Microsoft Edge Microsoft.Edge 110.0.1587.41 110.0.1587.46 winget
OBS Studio OBSProject.OBSStudio 28.1.2 29.0.2 winget
Microsoft ASP.NET Core 6.0.13 - Shared Framework (x86) Microsoft.DotNet.AspNetCore.6 6.0.13 6.0.14 winget
5 upgrades available.
1 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
5 package(s) have pins that prevent upgrade. Use the 'winget pin' command to view and edit pins. Using the --include-pinned argument may show more results.
PS C:\WINDOWS\system32> winget upgrade --include-pinned
Name Id Version Available Source
-----------------------------------------------------------------------------------------------------------------------
CCleaner Piriform.CCleaner 6.08 6.08.10255 winget
Git Git.Git 2.39.1 2.39.2 winget
Microsoft Edge Microsoft.Edge 110.0.1587.41 110.0.1587.46 winget
OBS Studio OBSProject.OBSStudio 28.1.2 29.0.2 winget
Microsoft ASP.NET Core 6.0.13 - Shared Framework (x86) Microsoft.DotNet.AspNetCore.6 6.0.13 6.0.14 winget
5 upgrades available.
1 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
5 package(s) have pins that prevent upgrade. Use the 'winget pin' command to view and edit pins. Using the --include-pinned argument may show more results.
PS C:\WINDOWS\system32> winget list "Windows Software Development"
Name Id Version Available Source
-------------------------------------------------------------------------------------------------------------------
Windows Software Development Kit - Windows 10.0.19041.685 Microsoft.WindowsSDK < 10.0.22000.832 10.0.22621.2 winget
Windows Software Development Kit - Windows 10.0.22621.755 Microsoft.WindowsSDK 10.0.22621.2 winget
Windows Software Development Kit - Windows 10.0.22000.832 Microsoft.WindowsSDK 10.0.22000.832 10.0.22621.2 winget
Windows Software Development Kit - Windows 10.0.26624 Microsoft.WindowsSDK < 10.0.22000.832 10.0.22621.2 winget
PS C:\WINDOWS\system32> winget list Office
Name Id Version Available Source
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft 365 Apps for enterprise - en-us Microsoft.Office 16.0.15601.20456 16.0.15928.20196 winget

Environment
PS C:\WINDOWS\system32> winget --info
Windows Package Manager (Preview) v1.5.441-preview
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.19045.2486
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.20.441.0
Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Links
---------------------------------------------------------------------------
Privacy Statement https://aka.ms/winget-privacy
License Agreement https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale
Admin Setting State
--------------------------------------------------
LocalManifestFiles Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride Disabled
LocalArchiveMalwareScanOverride Disabled
After looking at this more, I realize it may be because the pin types are "Blocking" pins. I would think they should still be listed, though, as it seems to be bad UX to never inform the user of an upgrade, even if they've chosen to require the pin to be removed before upgrade. Especially given that there is a string especially for this purpose -
<data name="UpgradeBlockingPinCount" xml:space="preserve">
<value>{0} package(s) have a blocking pin that needs to be removed before upgrade</value>
<comment>{Locked="{0}"} {0} is a placeholder that is replaced by an integer number of packages with blocking pins</comment>
</data>
PS C:\WINDOWS\system32> winget pin list
Id Source Version
------------------------------------------
Microsoft.Office winget Pinning
Microsoft.WindowsSDK winget Blocking
Piriform.CCleaner.ProTrial winget Pinning
PS C:\WINDOWS\system32> winget upgrade
Name Id Version Available Source
-----------------------------------------------------------------------------------------------------------------------
Microsoft Edge Microsoft.Edge 110.0.1587.41 110.0.1587.46 winget
OBS Studio OBSProject.OBSStudio 28.1.2 29.0.2 winget
Microsoft ASP.NET Core 6.0.13 - Shared Framework (x86) Microsoft.DotNet.AspNetCore.6 6.0.13 6.0.14 winget
3 upgrades available.
1 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
6 package(s) have pins that prevent upgrade. Use the 'winget pin' command to view and edit pins. Using the --include-pinned argument may show more results.
PS C:\WINDOWS\system32> winget upgrade --include-pinned
Name Id Version Available Source
-----------------------------------------------------------------------------------------------------------------------------
CCleaner Piriform.CCleaner 6.08 6.08.10255 winget
Microsoft Edge Microsoft.Edge 110.0.1587.41 110.0.1587.46 winget
Microsoft 365 Apps for enterprise - en-us Microsoft.Office 16.0.15601.20456 16.0.15928.20196 winget
OBS Studio OBSProject.OBSStudio 28.1.2 29.0.2 winget
Microsoft ASP.NET Core 6.0.13 - Shared Framework (x86) Microsoft.DotNet.AspNetCore.6 6.0.13 6.0.14 winget
5 upgrades available.
1 package(s) have version numbers that cannot be determined. Use --include-unknown to see all results.
4 package(s) have pins that prevent upgrade. Use the 'winget pin' command to view and edit pins. Using the --include-pinned argument may show more results.
Huh, looks like I completely forgot to use that string.
You can get the actual latest available versions with winget list. As you say, it is not shown on winget upgrade --include-pinned because the pins are blocking. My thinking was that winget upgrade would show exactly what you'd get if you did the upgrade. Since you wouldn't get the upgrades with blocking upgrades when you do winget upgrade --all --include-pinned, I decided to not show them there.
Maybe that is not an intuitive behavior.
Maybe when --include-pinned is used, blocking pins could be shown in a separate table (with the string :P) kind of like the ones which require explicit upgrade are?
Also, when the --include-pinned argument is used, the output probably shouldn't contain
Using the --include-pinned argument may show more results.