dotnet/wpf · error · XpsSerializationException

SR.ReachSerialization_NoSerializer

Error message

SR.ReachSerialization_NoSerializer

What it means

XpsOMFixedPageSerializer.SerializePageAsVisual throws XpsSerializationException (SR.ReachSerialization_NoSerializer) when the packaging/serialization manager cannot supply a serializer for the fixed page as visual. The serializer lookup returned null, so the page cannot be written and the operation is aborted with this explicit error rather than a NullReferenceException.

Solutions

  1. Ensure the serialization manager in use supports FixedPage/Visual types and provides a serializer for them
  2. Register or implement a serializer for the object type in a custom packaging serialization manager
  3. Verify the correct serializer stack (XpsOM vs classic XPS) is paired with the document being produced

Example fix

// before
var manager = new CustomSerializationManager(); // lacks FixedPage serializer
// after
var manager = new XpsOMSerializationManager(packagingPolicy); // standard manager with registered serializers
Defensive patterns

Strategy: fallback

Validate before calling

var serializer = manager.GetSerializer(typeof(FixedPage));
if (serializer == null) throw new NotSupportedException("No serializer registered for FixedPage");

Type guard

bool HasSerializer(IXpsSerializationManager m) => m?.GetSerializer(typeof(FixedPage)) != null;

Try / catch

try { pageSerializer.SerializeDisguisedVisual(visual); }
catch (XpsSerializationException ex) when (ex.Message.Contains("NoSerializer")) { /* manager lacks a serializer for this type */ }

Prevention

When it happens

Trigger: BeginPersistObjectData requests a serializer for a FixedPage-as-Visual and the manager's serializer factory (e.g. GetSerializer) returns null — typically for unsupported or unknown object types.

Common situations: Custom IXpsSerializationManager implementations that do not register a serializer for the given type; using XpsOM serializers with objects they do not recognize; partially initialized serialization managers.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/manager/XpsOMFixedPageSerializer.cs:358

        #region Private Methods

        private
        bool
        SerializePageAsVisual(
            Visual fixedPageAsVisual
            )
        {
            bool needEndVisual = false;

            ReachVisualSerializer serializer = new ReachVisualSerializer(SerializationManager);

            if (serializer != null)
            {
                needEndVisual = serializer.SerializeDisguisedVisual(fixedPageAsVisual);
            }
            else
            {
                throw new XpsSerializationException(SR.ReachSerialization_NoSerializer);
            }

            return needEndVisual;
        }

        #endregion Private Methods

        private XpsOMSerializationManager _xpsOMSerializationManager;
    };
}

View on GitHub (pinned to 81131a70a4)