`winget pin list` does not list all pins
Brief description of your issue
Not sure if this is the same root cause as #2973 but I'm filing it separately just in case. I have 3 pins configured, but only 2 are shown.
Steps to reproduce
Add some pins, then list them
Expected behavior
All pins to be listed
Actual behavior
Pin List - WinGet-2023-02-15-20-50-07.616.log

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
~What I think is happening:~ When listing the pins, we only show those for which we find an installed apps. That way you won't see pins for uninstalled apps. Then when you do winget pin, we look up installed apps matching Microsoft.Teams and we find two of them, we don't know which to pick so we default to none. A possible fix would be to know that we are doing winget pin list, and choose one of the matches arbitrarily, though I haven't thought it through.
Edit: I'm pretty sure that's what's happening from looking at the logs and #2973
Interesting; However, from #2973 it should still have been able to find Microsoft.WindowsSDK, since the package was present (granted, multiple versions were present).
Maybe what would be helpful here is a message of {0} pins could not be mapped to an installed package. Use winget pin list --all to show them anyways
I have the same problem on my machine.
And actually winget pin list --all is not working for me at all.
z002m76a winget --info
Windows Package Manager (Preview) v1.5.441-preview
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.22624.1391
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
z002m76a ~ in pwsh at 12:52:34 ```
Same issue
PS ...Sda\Code> winget pin add "IrfanView 4.60 (32-bit)"
Found IrfanView [IrfanSkiljan.IrfanView]
Pin added successfully
PS ...Sda\Code> winget pin list
Id Source Version
-------------------------------------
fjsoft.MyPhoneExplorer winget Pinning
Almico.SpeedFan winget Pinning