microsoft / microsoft/winget-cli

[WinGetUtil] WinGetCreateManifest returns failure for warning-only validation results

Open
#6,081 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug
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

  1. Use a manifest with InstallerType: exe that does not specify SilentWithProgress switch (e.g., Microsoft.WindowsAppRuntime.1.6 v1.6.9 from microsoft/winget-pkgs)
  2. Call WinGetCreateManifest with WinGetCreateManifestOption::SchemaAndSemanticValidation
  3. Observe that *succeeded is set to false and the HRESULT is 0x8A150004
  4. Run winget validate --manifest on the same manifest — observe "succeeded with warnings"

Environment

  • Manifests: Microsoft.WindowsAppRuntime.1.6 v1.6.9, Microsoft.WindowsAppRuntime.1.7 v1.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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.