{"record":{"id":"4753ea9a600a57c4","repo":"dotnet/wpf","slug":"reachpackaging-spotidrequiredattribute","errorCode":null,"errorMessage":"ReachPackaging_SpotIDRequiredAttribute","messagePattern":"ReachPackaging_SpotIDRequiredAttribute","errorType":"exception","errorClass":"XpsPackagingException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XPSSignatureDefinition.cs","lineNumber":341,"sourceCode":"        void\n        WriteXML(XmlWriter writer)\n        {\n            ArgumentNullException.ThrowIfNull(writer);\n\n            writer.WriteStartElement(\n             XpsS0Markup.SignatureDefinition,\n             XpsS0Markup.SignatureDefinitionNamespace\n            );\n\n            //Spot ID, Signer Name and xml:lang are attributes of SignatureDefinition\n            //Spot ID is required.  If it is not specified, then we throw.\n            if (SpotId != null)\n            {\n                writer.WriteAttributeString(XpsS0Markup.SpotId, XmlConvert.EncodeName(SpotId.ToString()));\n            }\n            else\n            {\n                throw new XpsPackagingException(SR.ReachPackaging_SpotIDRequiredAttribute);\n            }\n\n            if (RequestedSigner != null)\n            {\n                writer.WriteAttributeString(XpsS0Markup.RequestedSigner, RequestedSigner);\n            }\n\n            if (Culture != null)\n            {\n                XmlLanguage language = XmlLanguage.GetLanguage(Culture.Name);\n                writer.WriteAttributeString(XpsS0Markup.XmlLang, language.ToString());\n            }\n\n            //SpotLocation, Intent, Signby, and Signing Location are elements of SignatureDefinition\n            if (SpotLocation != null)\n            {\n                writer.WriteStartElement(XpsS0Markup.SpotLocation);\n","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XPSSignatureDefinition.cs#L323-L359","documentation":"Raised from XPSSignatureDefinition.WriteXML when serializing the SignatureDefinition element without a SpotId. Per the XPS specification the SpotID attribute is mandatory on a SignatureDefinition; when SpotId is null the writer cannot emit a valid element and throws XpsPackagingException instead of writing an invalid signature definition.","triggerScenarios":"Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XPSSignatureDefinition.cs:341 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the SpotId property on the XPSSignatureDefinition to a valid Guid before serializing with WriteXML","Ensure the SignatureDefinition element in the source XPS markup carries a SpotId attribute","Skip or reject signature definitions that lack a SpotId instead of attempting to write them"],"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-21T21:30:21.729Z"}