Repository navigation
Description
Brief description of your issue
A change in winget CLI introduced back between v1.7.3481-preview and v1.7.10514 (see diff here: v1.7.3481-preview...v1.7.10514) has broken it on Windows Build 10.0.17763.x, which is Windows 10 v1809 and Windows Server 2019.
The issue specifically is that when running an install command targeting a REST source - the package could be anything, doesn't matter:
winget install --id "Notepad++.Notepad++" --source internal-rest-source --no-upgrade --silent --scope machine --accept-source-agreements --disable-interactivity --verbose-logswinget will quit prematurely with exit code -1073741819 (0xc0000005)
the verbose log file ends with (full log in my comment below):
...
[CLI ] Source agreements satisfied. Source: internal-rest-source
[REPO] Creating PredefinedInstalledSource with filter [Machine]
[REPO] Creating new SQLite Index with version [Latest] at ':memory:'
[REPO] Reading MSI UpgradeCodes
[REPO] Examining ARP entries for Machine | X64
< Some log lines "Adding", "Skipping" or "Did not find" a bunch of programs >
[REPO] Examining ARP entries for Machine | X86
< Some log lines "Adding", "Skipping" or "Did not find" a bunch of programs >
[REPO] Examining MSIX entries for Machine
No errors. Looking at the source code, the last visible log message comes from here:
winget-cli/src/AppInstallerRepositoryCore/Microsoft/PredefinedInstalledSourceFactory.cpp
Lines 66 to 73 in 2741e91
| AICLI_LOG(Repo, Verbose, << "Examining MSIX entries for " << ScopeToString(scope)); | |
| IIterable<Package> packages; | |
| PackageManager packageManager; | |
| if (scope == Manifest::ScopeEnum::Machine) | |
| { | |
| packages = packageManager.FindProvisionedPackages(); | |
| } |
and right after writing the log message, the FindProvisionedPackages API is called which does not exist in Windows Build 17763 - the documentation says it was introduced in Build 19041 (which is Windows 10 v2004). The method not being there is also very easy to verify by attempting to call it in PowerShell:
jantari@server2019:C:\Windows\system32
└─ PS> [Windows.Management.Deployment.PackageManager,Windows.Management.Deployment,ContentType=WindowsRuntime]
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False PackageManager System.Runtime.InteropServices.WindowsRuntime.RuntimeClass
jantari@server2019:C:\Windows\system32
└─ PS> $pkgm = [Windows.Management.Deployment.PackageManager]::new()
jantari@server2019:C:\Windows\system32
└─ PS> $pkgm.FindProvisionedPackages()
Method invocation failed because [Windows.Management.Deployment.PackageManager] does not contain a method named 'FindProvisionedPackages'.
At line:1 char:1
+ $pkgm.FindProvisionedPackages()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
jantari@server2019:C:\Windows\system32
└─ PS>
All this is further corroborated by the fact that the command succeeds, even with the latest winget v1.10.340, if the --scope machine parameter is omitted, thus skipping that API call code path. So I am pretty sure this call is the only reason for the crash.
This is a bug because:
v1.7.10514and even the very latest release of winget are advertised as compatible with Windows 10 1809:
This release represents a servicing fix Windows Package Manager 1.10 release build for Windows 10 (1809+), and Windows 11.
- Even though Windows Server 2019 was never officially supported, winget versions
v1.7.3481-preview,v1.6.3482and prior worked great on it and it is wingets goal to make sure the Windows Package Manager works on earlier versions of Windows - thus it would be great if compatibility would be fixed, Server 2019 still has almost 4 years of life left.
Steps to reproduce
- Get a Windows Build 17763 machine compatible with winget (Windows 10 v1809 or Windows Server 2019 Core with the AppCompatibility feature-on-demand added or Windows Server 2019 Desktop Experience)
- Set up any winget version 1.7.10514 or later, up to and including the latest - on Windows Server 2019 the msix install won't work, so if you're testing with Windows Server extract and use an unpackaged winget instance
- Set up a private REST source
- Add the REST source to winget
- Attempt to install a program from the REST source with the above command, including the
--scope machineparameter
Expected behavior
winget should download and install the software.
Actual behavior
winget quits with exit code -1073741819 before completing the task.
Environment
WindowsPackageManager
MainCopyrightNotice
Windows: Windows.Server v10.0.17763.7009
SystemArchitecture
KeyDirectoriesHeader
----------------------------------------------------------------------------------------
Logs %TEMP%\WinGet\defaultState
UserSettings %LOCALAPPDATA%\Microsoft\WinGet\Settings\defaultState\settings.json
PortableLinksUser %LOCALAPPDATA%\Microsoft\WinGet\Links
PortableLinksMachine C:\Program Files\WinGet\Links
PortableRootUser %LOCALAPPDATA%\Microsoft\WinGet\Packages
PortableRoot C:\Program Files\WinGet\Packages
PortableRoot86 C:\Program Files (x86)\WinGet\Packages
InstallerDownloads %USERPROFILE%\Downloads
Links
--------------------------------------------------------------------------------
PrivacyStatement https://aka.ms/winget-privacy
LicenseAgreement https://aka.ms/winget-license
ThirdPartSoftwareNotices https://aka.ms/winget-3rdPartyNotice
MainHomepage https://aka.ms/winget
WindowsStoreTerms https://www.microsoft.com/en-us/storedocs/terms-of-sale
AdminSettingHeader StateHeader
-------------------------------------------------------
LocalManifestFiles StateDisabled
BypassCertificatePinningForMicrosoftStore StateDisabled
InstallerHashOverride StateDisabled
LocalArchiveMalwareScanOverride StateDisabled
Activity
jantari commentedon Mar 24, 2025
I want to add a log comparison between running the above command:
twice on the same machine, once with the last working version
v1.7.3481-previewand once with the next, broken versionv1.7.10514:Log file from v1.7.3481-preview (working)
Log file from v1.7.10514 (broken)
JohnMcPMS commentedon Mar 27, 2025
Could you post the data from
Event Viewer>Windows Logs>Applicationfor the event caused by this crash?Alternately, just confirm that it has failure GUID:
52535a66-ef3d-79a3-1cde-ae38af6d0268That crash (whose signature matches your report so far) is still occurring, but it has a vastly higher hit rate on older OS versions.
JohnMcPMS commentedon Mar 27, 2025
I think that the newer hits are unrelated; older hits seem to be the issue as you report.
FindProvisionedPackagesand thusIPackageManager9come in a later OS. I would have expected C++/WinRT to protect us from this QI failure with an exception.Wouldn't make things work any better, just less crashing.
I was going to do a fix in this area for an unrelated issue so I will throw in the check. I'm not going to implement a workaround, we just won't know the set of provisioned packages until the API is available.
You should be able to mitigate by passing
--forcetoinstall. That will bypass the attempt to determine what is installed, but it will obviously clash with your--no-upgradeflag which seems to want to know that.jantari commentedon Mar 27, 2025
I am not sure about the failure GUID, this is the information the crash event has when running winget v1.7.10514:
Full Event XML
As long as it doesn't crash anymore and just assumes no provisioned packages (empty list) that's perfect. Thank you.
More graceful MSIX enumeration failure handling (microsoft#5329)
jantari commentedon Jun 4, 2025
I can confirm that Server 2019 is working again as expected with
v1.11.220-preview.