microsoft / microsoft/winget-cli

Adding Azure DevOps based Microsoft.PreIndexed.Package Source fails

Open
#2,661 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Command-Source Issue-Bug
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

When adding a Microsoft.PreIndexed.Package based HTTPS source a HTTP HEAD operation is attemped to retrieve file size of Source.MSIX. This fails due to lack of HEAD method support on the Azure DevOps.

I've tested both git and tfsgit providers with same result.

Source Add Exception
0x80190195 : Method not allowed (405).

Relevant Log Entries
[REPO] Initializing source from: core => https://dev.azure.com/Tryll/DevTestLabs/_apis/git/repositories/Software-Repository/items?resolveLfs=true&%24format=octetStream&api-version=5.0&download=true&path=/source.msix
[FAIL] WindowsPackageManager.dll!00007FF970FA3022: ReturnHr(1) tid(1e4) 80190195 Method not allowed (405).
Msg:[D:\a_work\1\s\external\pkg\src\AppInstallerCommonCore\HttpStream\HttpClientWrapper.cpp(50)\WindowsPackageManager.dll!00007FF970F8F58A: (caller: 00007FF970E88BA9) Exception(1) tid(1e4) 80190195 Method not allowed (405).
]

[FAIL] WindowsPackageManager.dll!00007FF970E367C7: LogHr(1) tid(1e4) 80190195 Method not allowed (405).

HttpClientWrapper.cpp suggestion
HttpClientWrapper::PopulateInfoAsync() in src/AppInstallerCommonCore/HttpStream/HttpClientWrapper.cpp : already supports a non determined file size, but throws immediately on HTTP response other than HttpStatusCode::Ok. It should rather go directly for a GET operation with co_await SendHttpRequestAsync(0, 1);

Steps to reproduce

winget source add --verbose-logs -n core -a "https://dev.azure.com/Tryll/DevTestLabs/_apis/git/repositories/Software-Repository/items?resolveLfs=true&%24format=octetStream&api-version=5.0&download=true&path="
Adding source:
core -> https://dev.azure.com/Tryll/DevTestLabs/_apis/git/repositories/Software-Repository/items?resolveLfs=true&%24format=octetStream&api-version=5.0&download=true&path=
An unexpected error occurred while executing the command:
0x80190195 : Method not allowed (405).

Expected behavior

Source is added.

Actual behavior

winget source add --verbose-logs -n core -a "https://dev.azure.com/Tryll/DevTestL
abs/_apis/git/repositories/a352abf2-74c3-486c-8558-5eb0f525f163/items?path="
Adding source:
core -> https://dev.azure.com/Tryll/DevTestLabs/_apis/git/repositories/a352abf2-74c3-486c-8558-5eb0f525f163/items?path=
An unexpected error occurred while executing the command:
0x80190195 : Method not allowed (405).

Environment
Windows Package Manager v1.3.2691
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22000.1098
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.18.2691.0

Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/AppInstallerCommonCore/HttpStream/HttpClientWrapper.cpp, specifically HttpClientWrapper::PopulateInfoAsync(), and reproduce the failure with the provided winget source add command. Check how a 405 response from the Azure DevOps source is handled; done means the source is added successfully instead of failing with 0x80190195.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.