dotnet/wpf · error · XpsSerializationException

SR.ReachSerialization_NoSerializer

Error message

SR.ReachSerialization_NoSerializer

What it means

SerializePageContent looks up a ReachSerializer for a PageContent and, when GetSerializer returns null, throws XpsSerializationException(SR.ReachSerialization_NoSerializer). This happens while enumerating a FixedDocument's pages: one PageContent's referenced object has no registered serializer.

Solutions

  1. Verify each PageContent resolves to a standard FixedPage (check the page's Source URI loads correctly).
  2. Remove or replace custom/foreign page content types unsupported by the XPS writer.
  3. Log the offending PageContent before throwing so the bad page in the document can be identified.

Example fix

// before
serializer = manager.GetSerializer(pageContent);
// after
serializer = manager.GetSerializer(pageContent);
if (serializer == null)
    throw new XpsSerializationException($"No serializer for PageContent {pageContent.Source}");
Defensive patterns

Strategy: try-catch

Validate before calling

foreach (PageContent pc in fixedDocument.Pages)
    if (manager.GetSerializer(pc) == null)
        throw new InvalidOperationException($"No serializer for PageContent {pc.Source}");

Try / catch

try { serializer.SerializeObject(pageContent); }
catch (XpsSerializationException ex) when (ex.Message.Contains("NoSerializer")) { /* log pc.Source; skip or replace the page */ }

Prevention

When it happens

Trigger: During FixedDocument serialization, a PageContent whose child (typically the FixedPage from PageContent.GetPageRoot) cannot be resolved to a registered serializer type.

Common situations: PageContent entries whose page source fails to load and returns an unexpected type; mixed-version documents containing custom page content types.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/manager/NGCSerializer.cs:736

        /// The PageContent to be serialized.
        /// </param>
        private
        void
        SerializePageContent(
            object pageContent
            )
        {
            Toolbox.EmitEvent(EventTrace.Event.WClientDRXSavePageBegin);

            ReachSerializer serializer = SerializationManager.GetSerializer(pageContent);

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

            Toolbox.EmitEvent(EventTrace.Event.WClientDRXSavePageEnd);
        }

        #endregion Private Methods

        /// <summary>
        /// The method is called once the object data is discovered at that
        /// point of the serialization process.
        /// </summary>
        /// <param name="serializableObjectContext">
        /// The context of the object to be serialized at this time.
        /// </param>
        internal
        override
        void
        PersistObjectData(

View on GitHub (pinned to 81131a70a4)