{"record":{"id":"1b6756b47f3a6a78","repo":"dotnet/wpf","slug":"cannot-find-the-appropriate-serializer","errorCode":null,"errorMessage":"Cannot find the appropriate serializer.","messagePattern":"Cannot find the appropriate serializer\\.","errorType":"exception","errorClass":"XpsSerializationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/manager/NGCPageContentCollectionSerializerAsync.cs","lineNumber":210,"sourceCode":"        /// </summary>\n        /// <param name=\"pageContent\">\n        /// The PageContent to be serialized.\n        /// </param>\n        private \n        void \n        SerializePageContent(\n            object pageContent\n            )\n        {\n            ReachSerializer serializer = SerializationManager.GetSerializer(pageContent);\n\n            if(serializer!=null)\n            {\n                serializer.SerializeObject(pageContent);\n            }\n            else\n            {\n                throw new XpsSerializationException(SR.ReachSerialization_NoSerializer);\n            }\n        }\n\n        #endregion Private Methods\n    };\n\n    internal class NgcPageContentCollectionSerializerContext :\n                   NGCSerializerContext\n    {\n        public\n        NgcPageContentCollectionSerializerContext(\n            NGCSerializerAsync          serializer,\n            SerializableObjectContext   objectContext,\n            IEnumerator                 enumerator,\n            SerializerAction            action\n            ):\n            base(serializer,objectContext,action)\n        {","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/manager/NGCPageContentCollectionSerializerAsync.cs#L192-L228","documentation":"While serializing an individual PageContent, NGCPageContentCollectionSerializerAsync looks up a serializer for the page content's type via the serialization manager. If the manager cannot supply a ReachSerializer for that type, it throws XpsSerializationException 'Cannot find the appropriate serializer'.","triggerScenarios":"Serializing a PageContent whose inner object type has no registered/mapped serializer in the managers' type-to-serializer map (e.g. a non-standard object inside PageContent).","commonSituations":"Custom document structures or objects placed in a page content collection that the XPS serializer framework does not recognize.","solutions":["Ensure the object serialized is a standard PageContent/FixedPage structure","Register a serializer for the custom type with the serialization manager","Check that you are using the NGC async manager with supported types (FixedPage etc.)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"bool HasKnownSerializer(object o, XpsSerializationManager m) =>\n    m.GetSerializerFor(o.GetType()) != null;","tryCatchPattern":"try\n{\n    manager.SaveAsXaml(pageContents);\n}\ncatch (XpsSerializationException ex) when (ex.Message.Contains(\"serializer\"))\n{\n    // register a serializer for the unsupported type or fix object graph\n}","preventionTips":["Only put standard XPS types inside page content collections","Pre-check serializer availability for custom types before serializing"],"tags":["wpf","xps","serialization","missing-serializer"],"backgroundTag":"unsupported-operation","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"}