dotnet/wpf · error · XpsSerializationException

SR.ReachSerialization_NoSerializer

Error message

SR.ReachSerialization_NoSerializer

What it means

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).

Solutions

  1. Substitute a supported WPF element for the custom visual
  2. Register a serializer for the custom type with the serialization manager
  3. Pre-render the custom visual into an ImageSource (RenderTargetBitmap) and include that in the page

Example fix

// before
fixedPage.Children.Add(myThirdPartyGauge);
// after
var rtb = new RenderTargetBitmap((int)gauge.ActualWidth, (int)gauge.ActualHeight, 96, 96, PixelFormats.Pbgra32);
rtb.Render(myThirdPartyGauge);
fixedPage.Children.Add(new Image { Source = rtb });
Defensive patterns

Strategy: type-guard

Validate before calling

var serializer = serializationManager.GetSerializer(visual.GetType()); if (serializer == null) { /* pre-render or substitute the visual */ }

Type guard

bool HasSerializer(SerializationManager m, Visual v) => m?.GetSerializer(v.GetType()) != null;

Try / catch

try { SerializeNextUIElement(visual); }
catch (XpsSerializationException ex) when (ex.Message.Contains("NoSerializer")) { /* render to bitmap and continue */ }

Prevention

When it happens

Trigger: 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.

Common situations: Custom controls in documents written asynchronously via XpsDocument.BeginWrite; visuals added dynamically to pages; framework updates changing the set of natively serializable types.

Related errors


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/5b92eca367a80073. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/manager/ReachUIElementCollectionSerializerAsync.cs:213

        private 
        void 
        SerializeUIElement(
            object uiElement
            )
        {
            Visual visual = uiElement as Visual;

            if(visual != null)
            {
                ReachSerializer serializer = SerializationManager.GetSerializer(visual);

                if(serializer!=null)
                {
                    serializer.SerializeObject(visual);
                }
                else
                {
                    throw new XpsSerializationException(SR.ReachSerialization_NoSerializer);
                }
            }
        }

        #endregion Private Methods
    };

    internal class UIElementCollectionSerializerContext :
                   ReachSerializerContext
    {
        public
        UIElementCollectionSerializerContext(
            ReachSerializerAsync        serializer,
            SerializableObjectContext   objectContext,
            IEnumerator                 enumerator,
            SerializerAction            action
            ):
            base(serializer,objectContext,action)

View on GitHub (pinned to 81131a70a4)