{"record":{"id":"d28d58690bd74468","repo":"dotnet/wpf","slug":"sr-unexpectedxmltag-tag","errorCode":null,"errorMessage":"SR.UnexpectedXmlTag ({tag})","messagePattern":"SR\\.UnexpectedXmlTag \\((.+?)\\)","errorType":"exception","errorClass":"XmlException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/XmlSignatureManifest.cs","lineNumber":141,"sourceCode":"                {\n                    // Parse each reference - distinguish between Relationships and Parts\n                    // because we don't store the Relationship-part itself - just it's Relationships.\n                    PartManifestEntry partManifestEntry = ParseReference(reader);\n                    if (partManifestEntry.IsRelationshipEntry)\n                    {\n                        foreach (PackageRelationshipSelector relationshipSelector in partManifestEntry.RelationshipSelectors)\n                            relationshipManifest.Add(relationshipSelector);\n                    }\n                    else\n                        partManifest.Add(partManifestEntry.Uri);\n\n                    // return the manifest entry to be used for hashing\n                    partEntryManifest.Add(partManifestEntry);\n\n                    referenceCount++;\n                }\n                else\n                    throw new XmlException(SR.Format(SR.UnexpectedXmlTag, reader.Name));\n            }\n\n            // XmlDSig xsd requires at least one <Reference> tag\n            if (referenceCount == 0)\n                throw new XmlException(SR.PackageSignatureCorruption);\n        }\n\n        /// <summary>\n        /// Parse the DigestMethod tag\n        /// </summary>\n        /// <param name=\"reader\"></param>\n        private static string ParseDigestAlgorithmTag(XmlReader reader)\n        {\n            // verify namespace and lack of attributes\n            if (PackagingUtilities.GetNonXmlnsAttributeCount(reader) > 1\n                || !string.Equals(reader.NamespaceURI, SignedXml.XmlDsigNamespaceUrl, StringComparison.Ordinal)\n                || reader.Depth != 3)\n                throw new XmlException(SR.XmlSignatureParseError);","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/XmlSignatureManifest.cs#L123-L159","documentation":"XmlSignatureManifest.ParseManifest throws this XmlException when it encounters an XML tag inside the Signature/Manifest that is not one of the expected tags (Reference, Object, etc.); the message names the unexpected tag. The digital-signature XML deviates from the expected OPC signature manifest structure.","triggerScenarios":"Thrown at src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/XmlSignatureManifest.cs:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the signature manifest XML only contains expected tags (Manifest, Reference with Relationship/Part forms)","Remove or fix the unexpected '{tag}' element in the SignatureManifest part","Treat the parse failure as an invalid/corrupted signature manifest and reject the package signature"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}