{"record":{"id":"beb7737082248665","repo":"dotnet/wpf","slug":"0-1-element-found-expected-fixed-page-element-2-3","errorCode":null,"errorMessage":"\"{{{0}}}{1}\" element found. Expected fixed page element ({{{2}}}{3}).","messagePattern":"\"(.+?)\\}\\}(.+?)\" element found\\. Expected fixed page element \\((.+?)\\}\\}(.+?)\\)\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/XmlFixedPageInfo.cs","lineNumber":37,"sourceCode":"        //  Constructors\n        //\n        //------------------------------------------------------\n\n        #region Constructors\n        /// <summary>\n        /// Initialize object from DOM node.\n        /// </summary>\n        /// <remarks>\n        /// The DOM node is assumed to be a XAML FixedPage element. Its namespace URI\n        /// is subsequently used to look for its nested Glyphs elements (see private property NodeList).\n        /// </remarks>\n        internal XmlFixedPageInfo(XmlNode fixedPageNode)\n        {\n            _pageNode = fixedPageNode;\n            Debug.Assert(_pageNode != null);\n            if (_pageNode.LocalName != _fixedPageName || _pageNode.NamespaceURI != ElementTableKey.FixedMarkupNamespace)\n            {\n                throw new ArgumentException(SR.Format(SR.UnexpectedXmlNodeInXmlFixedPageInfoConstructor,\n                    _pageNode.NamespaceURI, _pageNode.LocalName,\n                    ElementTableKey.FixedMarkupNamespace, _fixedPageName));\n            }\n        }\n        #endregion Constructors\n\n        //------------------------------------------------------\n        //\n        //  Internal Methods\n        //\n        //------------------------------------------------------\n\n        #region Internal Methods\n        /// <summary>\n        /// Get the glyph run at zero-based position 'position'.\n        /// </summary>\n        /// <remarks>\n        /// Returns null for a nonexistent position. No exception raised.","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/XmlFixedPageInfo.cs#L19-L55","documentation":"XmlFixedPageInfo's constructor only accepts an XML node that is a FixedPage element in the FixedMarkup namespace. If the passed node has a different LocalName or NamespaceURI, the constructor throws ArgumentException because it would otherwise silently build inconsistent page metadata.","triggerScenarios":"Calling new XmlFixedPageInfo(node) with a node that is not a <FixedPage> in the fixed markup namespace — e.g. a FixedDocument, FixedDocumentSequence, or a FixedPage in the wrong namespace.","commonSituations":"Parsing XPS document parts generically and passing whatever XmlNode is found at the part root, or handling XPS packages where the FixedPage element is emitted under a mistyped/legacy namespace.","solutions":["Verify the node's LocalName equals \"FixedPage\" and its NamespaceURI equals ElementTableKey.FixedMarkupNamespace before constructing XmlFixedPageInfo","Navigate the XML tree to the actual FixedPage element instead of passing a container node such as FixedDocument","Fix namespace declarations in the XPS markup if the FixedPage is emitted under an incorrect namespace"],"exampleFix":"// before\nvar info = new XmlFixedPageInfo(doc.DocumentElement);\n// after\nvar root = doc.DocumentElement;\nif (root.LocalName == \"FixedPage\" && root.NamespaceURI == fixedMarkupNs)\n{\n    var info = new XmlFixedPageInfo(root);\n}","handlingStrategy":"validation","validationCode":"if (node == null) throw new ArgumentNullException(nameof(node));\nif (node.LocalName != \"FixedPage\" || node.NamespaceURI != fixedMarkupNs)\n    throw new ArgumentException($\"Expected FixedPage element, got {node.NamespaceURI}:{node.LocalName}\");","typeGuard":"static bool IsFixedPage(XmlNode n) =>\n    n != null && n.LocalName == \"FixedPage\" &&\n    n.NamespaceURI == \"http://schemas.microsoft.com/xps/2005/06\";","tryCatchPattern":"try { var info = new XmlFixedPageInfo(node); }\ncatch (ArgumentException ex) { /* log node.LocalName/NamespaceURI and skip part */ }","preventionTips":["Always select FixedPage nodes via XPath constrained to the fixed markup namespace","Validate the XPS part content type ([Content_Types].xml) before parsing","Unit-test parsers against malformed XPS documents"],"tags":["wpf","xps","xml","argument"],"backgroundTag":"invalid-argument-value","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"}