{"record":{"id":"5b92eca367a80073","repo":"dotnet/wpf","slug":"sr-reachserialization-noserializer-5b92ec","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/ReachUIElementCollectionSerializerAsync.cs","lineNumber":213,"sourceCode":"        private \n        void \n        SerializeUIElement(\n            object uiElement\n            )\n        {\n            Visual visual = uiElement as Visual;\n\n            if(visual != null)\n            {\n                ReachSerializer serializer = SerializationManager.GetSerializer(visual);\n\n                if(serializer!=null)\n                {\n                    serializer.SerializeObject(visual);\n                }\n                else\n                {\n                    throw new XpsSerializationException(SR.ReachSerialization_NoSerializer);\n                }\n            }\n        }\n\n        #endregion Private Methods\n    };\n\n    internal class UIElementCollectionSerializerContext :\n                   ReachSerializerContext\n    {\n        public\n        UIElementCollectionSerializerContext(\n            ReachSerializerAsync        serializer,\n            SerializableObjectContext   objectContext,\n            IEnumerator                 enumerator,\n            SerializerAction            action\n            ):\n            base(serializer,objectContext,action)","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/manager/ReachUIElementCollectionSerializerAsync.cs#L195-L231","documentation":"In the async pipeline, SerializeUIElement resolves a serializer for each visual from the registered serializer map; when no serializer exists for the visual's type, the framework cannot enqueue serialization work for it and throws XpsSerializationException (ReachSerialization_NoSerializer).","triggerScenarios":"During async XPS serialization (SerializeNextUIElement path from XpsSerializationManagerAsync), encountering a visual whose type has no registered ReachSerializer — typically a custom or third-party visual embedded in a FixedPage.","commonSituations":"Custom controls in documents written asynchronously via XpsDocument.BeginWrite; visuals added dynamically to pages; framework updates changing the set of natively serializable types.","solutions":["Substitute a supported WPF element for the custom visual","Register a serializer for the custom type with the serialization manager","Pre-render the custom visual into an ImageSource (RenderTargetBitmap) and include that in the page"],"exampleFix":"// before\nfixedPage.Children.Add(myThirdPartyGauge);\n// after\nvar rtb = new RenderTargetBitmap((int)gauge.ActualWidth, (int)gauge.ActualHeight, 96, 96, PixelFormats.Pbgra32);\nrtb.Render(myThirdPartyGauge);\nfixedPage.Children.Add(new Image { Source = rtb });","handlingStrategy":"type-guard","validationCode":"var serializer = serializationManager.GetSerializer(visual.GetType()); if (serializer == null) { /* pre-render or substitute the visual */ }","typeGuard":"bool HasSerializer(SerializationManager m, Visual v) => m?.GetSerializer(v.GetType()) != null;","tryCatchPattern":"try { SerializeNextUIElement(visual); }\ncatch (XpsSerializationException ex) when (ex.Message.Contains(\"NoSerializer\")) { /* render to bitmap and continue */ }","preventionTips":["Avoid third-party/custom visuals in async XPS output","Pre-render unsupported visuals to images","Verify serializer coverage of the visual tree before BeginWrite"],"tags":["wpf","xps","serialization","async","unsupported-type"],"backgroundTag":"operation-not-supported","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"}