Skip to content

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

@msftrubengu

Description

@msftrubengu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIt either shouldn't be doing this or needs an investigation.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions