microsoft / microsoft/winget-cli
[WinGetUtil] WinGetCreateManifest returns failure for warning-only validation results
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
Summary
WinGetCreateManifest in Exports.cpp hardcodes validateOption.ThrowOnWarning = true when called with WinGetCreateManifestOption::SchemaAndSemanticValidation. This causes manifests that produce only warnings (not errors) to throw ManifestException with HRESULT 0x8A150004 (APPINSTALLER_CLI_ERROR_MANIFEST_FAILED). While the catch handler at line ~363 checks IsWarningOnly() and attempts recovery, the caller still receives a failure for manifests that winget validate --manifest reports as "Manifest validation succeeded with warnings."
Expected Behavior
Manifests that pass winget validate --manifest with "succeeded with warnings" should also succeed when validated through WinGetCreateManifest with SchemaAndSemanticValidation. Warning-only results should set *succeeded = true.
Actual Behavior
The manifest fails with HRESULT 0x8A150004. The native log shows:
YamlParser.cpp(606)\WinGetUtil.dll: Exception(1) 8A150004
Running winget validate --manifest on the same manifest outputs:
Manifest validation succeeded with warnings.
Manifest Warning: Silent and SilentWithProgress switches are not specified for InstallerType exe.
Please make sure the installer can run unattended.
Steps to Reproduce
- Use a manifest with
InstallerType: exethat does not specifySilentWithProgressswitch (e.g.,Microsoft.WindowsAppRuntime.1.6v1.6.9 frommicrosoft/winget-pkgs) - Call
WinGetCreateManifestwithWinGetCreateManifestOption::SchemaAndSemanticValidation - Observe that
*succeededis set tofalseand the HRESULT is0x8A150004 - Run
winget validate --manifeston the same manifest — observe "succeeded with warnings"
Environment
- Manifests:
Microsoft.WindowsAppRuntime.1.6v1.6.9,Microsoft.WindowsAppRuntime.1.7v1.7.8 - These manifests exist in production
microsoft/winget-pkgs
Additional Context
The issue is in Exports.cpp around line 348:
if (WI_IsFlagSet(option, WinGetCreateManifestOption::SchemaValidation) ||
WI_IsFlagSet(option, WinGetCreateManifestOption::SchemaAndSemanticValidation))
{
validateOption.FullValidation = true;
validateOption.ThrowOnWarning = true; // <-- hardcoded
}
The ThrowOnWarning = true setting causes YamlParser.cpp line 604 to throw for warnings: if (validateOption.ThrowOnWarning || !ex.IsWarningOnly()). The catch handler at line 363 does check e.IsWarningOnly() and sets *succeeded = true for warning-only cases, but callers consuming WinGetUtil via COM interop still observe the failure as a COMException with 0x8A150004.
Callers of WinGetCreateManifest (such as validation services) cannot control the ThrowOnWarning flag — it is set internally based on the option flags.
🏴☠️ Prepared by the Thousand Sunny's AI-powered crew. We've charted this bug to the best of our ability, but every map has its blind spots — the maintainers' expertise is the true compass here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read Exports.cpp around lines 348-363 and YamlParser.cpp around lines 604-606, then reproduce the behavior with the Microsoft.WindowsAppRuntime.1.6 v1.6.9 manifest. Compare WinGetCreateManifest with winget validate --manifest; done means warning-only validation sets *succeeded to true without returning HRESULT 0x8A150004.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100