QL-Win/QuickLook · error · InvalidDataException

AppxManifest.xml not found

Error message

AppxManifest.xml not found

What it means

Thrown by AppxReader.Open when the zip archive has no entry named 'AppxManifest.xml'. Every valid .appx/.msix package must contain this manifest at the archive root. Its absence indicates the file is not an app package, is corrupt, or uses a non-standard layout. The error is an InvalidDataException.

Source

Thrown at QuickLook.Plugin/QuickLook.Plugin.AppViewer/PackageParsers/Appx/AppxReader.cs:99

        Open();
    }

    public AppxReader(string path)
    {
        zip = new ZipFile(path);
        Open();
    }

    public void Dispose()
    {
        zip?.Close();
        zip = null;
    }

    private void Open()
    {
        ZipEntry entry = zip.GetEntry("AppxManifest.xml")
            ?? throw new InvalidDataException("AppxManifest.xml not found");

        XmlDocument xml = new() { XmlResolver = null };
        xml.Load(zip.GetInputStream(entry));

        XmlElement packageNode = xml.DocumentElement;

        // Identity
        {
            XmlElement identityNode = packageNode["Identity"];

            if (identityNode != null)
            {
                Name = identityNode.Attributes["Name"]?.Value;
                Version = identityNode.Attributes["Version"]?.Value;
                Publisher = identityNode.Attributes["Publisher"]?.Value;

                Match m = Regex.Match(Publisher, @"CN=([^,]*),?");
                if (m.Success) Publisher = m.Groups[1].Value;

View on GitHub (pinned to cb5d9c429c)

Solutions

  1. Verify the zip contains 'AppxManifest.xml' before constructing AppxReader.
  2. If the file is an .appxbundle, use AppxBundleReader which locates the inner .appx and its manifest automatically.
  3. Check the file extension/content and reject non-app packages early with a clear message.
  4. Catch InvalidDataException and report the file as unsupported.

Example fix

// before
var reader = new AppxReader(path);

// after
using var zip = new ICSharpCode.SharpZipLib.Zip.ZipFile(path);
bool hasManifest = zip.GetEntry("AppxManifest.xml") != null;
zip.Close();
if (!hasManifest)
    throw new InvalidDataException($"{path} is not a valid .appx (AppxManifest.xml missing).");
var reader = new AppxReader(path);
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the zip contains AppxManifest.xml before constructing AppxReader.
public static bool IsAppx(string path)
{
    try
    {
        using var zip = new ICSharpCode.SharpZipLib.Zip.ZipFile(path);
        return zip.GetEntry("AppxManifest.xml") != null;
    }
    catch { return false; }
}

Try / catch

try { var reader = new AppxReader(path); }
catch (InvalidDataException ex) when (ex.Message.Contains("AppxManifest"))
{
    // Not a valid .appx; if it's a bundle, use AppxBundleReader instead.
}

Prevention

When it happens

Trigger: Constructing new AppxReader(stream) or new AppxReader(path) on a non-.appx zip, a corrupt package, or a bundle (.appxbundle) whose top-level entries are nested .appx files rather than a flat AppxManifest.xml.

Common situations: Passing an .appxbundle to AppxReader (should use AppxBundleReader); a truncated download; a repackaged or stripped app package; an .msix with an unexpected manifest location.

Related errors


AI-assisted analysis of QL-Win/QuickLook@cb5d9c429c (2026-08-13). Data as JSON: /api/errors/5bd20c8164171e54. Report an issue: GitHub.