{"record":{"id":"4fb1531b22f60edf","repo":"dotnet/wpf","slug":"sr-requiredtagnotfound-template-requiredtagnotfound-arg-4fb153","errorCode":null,"errorMessage":"SR.RequiredTagNotFound (template: RequiredTagNotFound, arg: signatureTimeTag)","messagePattern":"SR\\.RequiredTagNotFound \\(template: RequiredTagNotFound, arg: signatureTimeTag\\)","errorType":"exception","errorClass":"System.Xml.XmlException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/XmlSignatureProperties.cs","lineNumber":315,"sourceCode":"                        && (reader.NodeType == XmlNodeType.EndElement))\n                        {\n                            //We must find a  </SignatureProperty> tag at this point, \n                            //else it could be that there are more SignatureTime or  \n                            //other tags nested here and that is an error.\n                            if (reader.Read()\n                                && reader.MoveToContent() == XmlNodeType.EndElement\n                                && string.Equals(signaturePropertyTag, reader.LocalName, StringComparison.Ordinal))\n                                break;\n                            else\n                                throw new XmlException(SR.PackageSignatureCorruption);\n                        }\n                        else\n                            // if we do not find the nested elements as expected\n                            throw new XmlException(SR.PackageSignatureCorruption);\n                }\n            }\n            else\n                throw new XmlException(SR.Format(SR.RequiredTagNotFound, signatureTimeTag));\n\n\n            // generate an equivalent DateTime object\n            if (timeValue != null && timeFormat != null)\n                return XmlFormattedTimeToDateTime(timeValue, timeFormat);\n            else\n                throw new XmlException(SR.PackageSignatureCorruption);\n        }\n        \n        /// <summary>\n        /// DateTime to XML Format\n        /// </summary>\n        /// <param name=\"dt\">date time to convert</param>\n        /// <param name=\"format\">format to use - specified in DateTime syntax</param>\n        /// <returns>opc-legal string suitable for embedding in XML digital signatures</returns>\n        private static String DateTimeToXmlFormattedTime(DateTime dt, string format)\n        {\n            DateTimeFormatInfo formatter = new DateTimeFormatInfo","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/XmlSignatureProperties.cs#L297-L333","documentation":"The <SignatureTime> wrapper element itself was not found where the parser required it: ParseSignatureTimeTag throws XmlException with SR.Format(SR.RequiredTagNotFound, signatureTimeTag), i.e. 'Required tag <SignatureTime> not found'. This differs from corruption (5000-5003): the property content is missing the mandatory tag entirely.","triggerScenarios":"ParseSigningTime -> ParseSignatureTimeTag invoked on a signature whose <SignatureProperty> lacks a <SignatureTime> element — e.g. a signature created without signature properties, or with properties signed under a different Object Id.","commonSituations":"Reading the signing time of signatures produced by external tools that do not emit the standard SignatureTime property; signatures where the Id/Value references point to the wrong property.","solutions":["Confirm the signature includes a <SignatureTime> SignatureProperty before asking for signing time (check Signature.SignedBy / properties collection)","Re-sign with PackageDigitalSignatureManager.Sign, which emits the property automatically","Fall back to parsing the embedded XML signature yourself if a non-WPF tool created it","Skip signatures lacking the property rather than assuming they are corrupt"],"exampleFix":"// guard before reading\ndynamic sig = packageSignatures[0];\nif (!sig.IsCertificateExists || sig.SignatureProperties == null)\n    return; // no SignatureTime property present\n// then ParseSigningTime","handlingStrategy":"validation","validationCode":"// Ensure a SignatureTime property exists before asking for the signing time\nbool HasSignatureTime(System.IO.Packaging.PackageDigitalSignature sig)\n{\n    foreach (var rel in sig.SignaturePart.GetRelationships()) { /* signature properties present */ }\n    var xml = new System.Xml.XmlDocument();\n    xml.Load(sig.SignaturePart.GetStream());\n    return xml.GetElementsByTagName(\"SignatureTime\").Count > 0;\n}","typeGuard":null,"tryCatchPattern":"try { var t = GetSigningTime(sig); }\ncatch (XmlException ex) when (ex.Message.Contains(\"RequiredTagNotFound\") || ex.Message.Contains(\"not found\")) {\n    return (signingTime: (DateTime?)null, trusted: false);\n}","preventionTips":["Sign packages with PackageDigitalSignatureManager, which always emits SignatureTime","Detect signatures created by external tools and handle missing properties explicitly","Unit-test signature parsing on packages signed by every tool in your pipeline"],"tags":["wpf","packaging","xml","digital-signature","missing-element"],"backgroundTag":"missing-required-argument","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}