-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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.