Brief description of your issue
https://github.com/microsoft/winget-cli/blob/1b74fd4d7ded2874254e1e8da3a3605ef20b3530/src/Microsoft.Management.Deployment/Helpers.cpp#L81C72-L81C134
EnsureProcessHasCapability calls AppCapability::CreateWithProcessIdForUser and passes nullptr as the user (which is not something the documentation for that method allows, but it wouldn't be the first underdocumented method...). When that call happens in a program without package identity on Windows 10 1903, this fails with E_INVALIDARG, which makes PackageCatalogReference::Connect fail.
Steps to reproduce
- Get a
PackageCatalogReference object.
- Call
Connect on Windows 10 1903.
- The extended error code will be
E_INVALIDARG.
Reproducer
Expected behavior
Connecting to a package catalog succeeds.
Actual behavior
Connecting to a package catalog fails with E_INVALIDARG.
onecore\base\devices\cam\winrt\lib\appcapabilityaccessfactory.cpp(32)\CapabilityAccessManagerClient.dll!6F6ADE82: (caller: 7027946E) ReturnHr(1) tid(181c) 80070057 The parameter is incorrect.
WindowsPackageManager.dll!70279491: LogHr(1) tid(181c) 80070057 The parameter is incorrect.
(b6c.181c): Windows Runtime Originate Error - code 40080201 (first chance)
EXCEPTION: WinRTOriginateError
hr = 0x80070057
Message: The parameter is incorrect.
Environment
Microsoft.WindowsPackageManager.InProcCom.1.10.340 from NuGet