winget-cli
winget-cli copied to clipboard
Unable to open PowerShell because of an exception that was thrown at the console related to Winget CLI [PFA}
Brief description of your issue
I'm using PowerShell v7.4.2 with Windows Terminal v1.20.11271.0 and winget.exe v1.7.11261. My laptop was not connected to the internet. When I opened the terminal, since PowerShell was my default profile, it opened but couldn't open the console. An exception was thrown on the console.
After connecting to the internet, it worked fine.
Steps to reproduce
- Turn off the internet connection
- Open PowerShell
Expected behavior
Expected the PowerShell console to open without any issues
Actual behavior
Console didn't open due to an exception raised
Environment
❯ winget.exe --info
Windows Package Manager v1.7.11261
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.22621.3593
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.11261.0
Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Portable Links Directory (User) %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User) %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root C:\Program Files\WinGet\Packages
Portable Package Root (x86) C:\Program Files (x86)\WinGet\Packages
Installer Downloads %USERPROFILE%\Downloads
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
There was a new feature that - when given an unknown command, would lookup that command against winget list, and suggest any matches to package name, moniker, or commands. Or something very similar to this.
Related tangent: The package manager performs its matching against a copy of the repo stored in source.msix - if this file is more than 5 minutes old, it downloads a new copy, which might take several seconds.
It sounds like this feature might expect an Internet connection, and pre-seed the download process by calling winget list on startup. This way, when a user types vi textfile.txt on a new system, the shell can respond with something similar to "Try winget install vim".
Is it possible that this feature was released without testing the situation of not having an Internet connection?
This is caused by the PowerToys CommandNotFound module
Related issues in the relevant repositories:
- https://github.com/microsoft/PowerToys/issues/33065
- https://github.com/microsoft/winget-command-not-found/issues/7
[Policy] Area-External
It looks like this was fixed via:
- https://github.com/microsoft/winget-command-not-found/issues/7