{"record":{"id":"e1e054384499e80f","repo":"dotnet/wpf","slug":"sr-reachserialization-noserializer-xpsserializationmanager","errorCode":null,"errorMessage":"SR.ReachSerialization_NoSerializer","messagePattern":"SR\\.ReachSerialization_NoSerializer","errorType":"exception","errorClass":"XpsSerializationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/manager/XpsSerializationManager.cs","lineNumber":154,"sourceCode":"                //\n                // Things that need to be done at this stage\n                // 1. Setting the stack context\n                // 2. Setting the root of the graph for future references\n                //\n                reachSerializer.SerializeObject(serializedObject);\n\n                if(_isBatchMode)\n                {\n                    _simulator.SimulateEndFixedPage(pageXmlWriter);\n                }\n                else\n                {\n                    _simulator.EndConfirmToXPSStructure(_isBatchMode);\n                }\n            }\n            else\n            {\n                throw new XpsSerializationException(SR.ReachSerialization_NoSerializer);\n            }\n\n            Toolbox.EmitEvent(EventTrace.Event.WClientDRXSaveXpsEnd);\n        }\n\n        /// <summary>\n        ///\n        /// </summary>\n        public\n        virtual\n        void\n        Commit(\n            )\n        {\n            if(_isBatchMode && _isSimulating)\n            {\n                _simulator.EndConfirmToXPSStructure(_isBatchMode);\n            }","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/manager/XpsSerializationManager.cs#L136-L172","documentation":"XpsSerializationManager.SaveAsXaml throws XpsSerializationException with SR.ReachSerialization_NoSerializer when GetSerializer(serializedObject) returns null, i.e. the type passed the root-type check but no ReachSerializer is registered for its concrete type. The manager cannot find a serializer to drive the object graph.","triggerScenarios":"Calling SaveAsXaml with a supported-looking root whose concrete/runtime type has no registered ReachSerializer (e.g., a custom subclass of FixedDocument/FixedPage that lacks serializer metadata), or with a paginator wrapper that resolves to an unexpected source type.","commonSituations":"Subclassing FixedPage/FixedDocument and passing the subclass to SaveAsXaml; custom serializers removed or not registered in the serializer provider; version differences where a type lost its serializer mapping.","solutions":["Serialize concrete, non-derived FixedDocumentSequence/FixedDocument/FixedPage instances rather than custom subclasses.","Register a ReachSerializer for the custom type via the serializer provider/manager if custom types are required.","Inspect GetSerializer's type mapping and confirm the runtime type passed (GetType(), not declared type).","Unwrap paginators correctly so the underlying FixedDocument/FixedDocumentSequence is what gets serialized."],"exampleFix":"// before: subclass has no serializer\nmanager.SaveAsXaml(new MyCustomPage());\n\n// after: build standard page from the subclass content\nvar page = new FixedPage();\nforeach (var child in myCustomPage.Children) FixedPage.Children.Add(page, child);\nmanager.SaveAsXaml(page);","handlingStrategy":"try-catch","validationCode":"// concrete type must map to a registered ReachSerializer\nbool serializerExists = manager.GetSerializer(root) is not null; // if accessible\n","typeGuard":"static bool HasConcreteSerializer(object o) => o.GetType() == typeof(FixedDocumentSequence) || o.GetType() == typeof(FixedDocument) || o.GetType() == typeof(FixedPage);","tryCatchPattern":"try { manager.SaveAsXaml(obj); }\ncatch (XpsSerializationException ex) { /* no serializer for concrete type; rebuild as standard FixedDocument/FixedPage */ }","preventionTips":["Avoid serializing subclasses of FixedDocument/FixedPage","Register serializers for any custom types","Pass concrete standard types, not derived wrappers"],"tags":["wpf","xps","serialization","serializer"],"backgroundTag":"missing-dependency","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"}