beeradmoore/dlss-swapper · error · Exception

Could not find any Application nodes in

Error message

Could not find any Application nodes in {appManifestFile}

What it means

XboxGame.LoadApplicationId parses an Xbox game's appmanifest.xml and selects //ns:Applications/ns:Application nodes to read the game's application Id. The thrown message fires when the XPath query returns null — meaning the manifest contains no Application entries. Note the source checks `applicationNodes is null`, which only happens in edge XML cases; an empty node list would skip the foreach silently, so this throw indicates an unexpected/invalid manifest shape.

Solutions

  1. Verify the path passed in points to a valid appmanifest.xml inside the game's Xbox package folder (not a placeholder or partial download).
  2. Confirm the manifest's xmlns matches the namespace added to the XmlNamespaceManager; log doc.DocumentElement.NamespaceURI and adjust the XPath if it differs.
  3. Make the XPath resilient: select both namespaced and non-namespaced forms (//ns:Applications/ns:Application | //Applications/Application).
  4. If Microsoft changed the schema, update the XPath to the new element names and re-test against a freshly installed game.
  5. Reinstall/repair the game via the Xbox app if the manifest is genuinely missing the Applications section.

Example fix

// before
var applicationNodes = doc.SelectNodes("//ns:Applications/ns:Application", nsmgr);
if (applicationNodes is null)
    throw new System.Exception($"Could not find any Application nodes in {appManifestFile}");
// after
var applicationNodes = doc.SelectNodes("//ns:Applications/ns:Application", nsmgr)
    ?? doc.SelectNodes("//Applications/Application");
if (applicationNodes is null || applicationNodes.Count == 0)
    throw new System.Exception($"Could not find any Application nodes in {appManifestFile}");
Defensive patterns

Strategy: validation

Validate before calling

if (!File.Exists(appManifestFile)) throw new FileNotFoundException("appmanifest.xml missing", appManifestFile);
var doc = new XmlDocument(); doc.Load(appManifestFile);
bool hasApplications = doc.SelectNodes("//ns:Applications/ns:Application", nsmgr)?.Count > 0
    || doc.SelectNodes("//Applications/Application")?.Count > 0;
if (!hasApplications) { /* skip game / log warning */ }

Type guard

static bool HasApplicationNodes(XmlDocument doc, XmlNamespaceManager nsmgr)
    => doc?.DocumentElement != null
       && (doc.SelectNodes("//ns:Applications/ns:Application", nsmgr)?.Count > 0
           || doc.SelectNodes("//Applications/Application")?.Count > 0);

Try / catch

try
{
    var gameId = XboxGame.LoadApplicationId(manifestPath);
}
catch (Exception ex) when (ex.Message.StartsWith("Could not find any Application nodes"))
{
    Logger.Warn(ex, "Skipping game with invalid manifest: " + manifestPath);
}

Prevention

When it happens

Trigger: Calling LoadApplicationId on an appmanifest.xml whose <Applications> element is missing, is empty, uses an unexpected namespace (so the ns: prefix does not match), or is a legacy/different manifest schema without Application nodes.

Common situations: Xbox app / Game Pass manifest schema changes after Microsoft Store updates; Xbox games installed to a non-standard location with a truncated or corrupted manifest; scanning a folder that is not actually an Xbox package install; namespace mismatches between the document and the injected ns prefix.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.


AI-assisted analysis of beeradmoore/dlss-swapper@ab9b1e2d4b (2026-09-15). Data as JSON: /api/errors/68d8234a73d90fc4. Report an issue: GitHub.

Appendix: source

Thrown at src/Data/Xbox/XboxGame.cs:57

            return;
        }

        var appManifestFile = Path.Combine(InstallPath, "appxmanifest.xml");
        if (File.Exists(appManifestFile))
        {
            try
            {
                var doc = new XmlDocument();
                doc.Load(appManifestFile);

                var nsmgr = new XmlNamespaceManager(doc.NameTable);
                string ns = doc.DocumentElement?.NamespaceURI ?? string.Empty;
                nsmgr.AddNamespace("ns", ns);

                var applicationNodes = doc.SelectNodes("//ns:Applications/ns:Application", nsmgr);
                if (applicationNodes is null)
                {
                    throw new System.Exception($"Could not find any Application nodes in {appManifestFile}");
                }

                foreach (XmlNode appNode in applicationNodes)
                {
                    var appId = appNode.Attributes?["Id"]?.Value ?? string.Empty;
                    if (string.IsNullOrWhiteSpace(appId))
                    {
                        continue;
                    }

                    ApplicationId = appId;
                }
            }
            catch (Exception err)
            {
                Logger.Error(err, $"Could not load ApplicationId for {PlatformId}");
            }
        }

View on GitHub (pinned to ab9b1e2d4b)