dotnet/wpf · error · XpsSerializationException
SR.ReachSerialization_NoSerializer
Error message
SR.ReachSerialization_NoSerializer
What it means
Async NGCSerializationManager.SaveAsXaml, after deciding how to schedule the SaveAsXaml work item, found no serializer registered for the object's type and threw XpsSerializationException(SR.ReachSerialization_NoSerializer). This is the async twin of the synchronous NGCSerializationManager check, hit when GetSerializer returns null for the queued object.
Solutions
- Pass only FixedDocumentSequence / FixedDocument / FixedPage objects to SaveAsXaml.
- Register or select the correct serializer for the type before starting the async save.
- Add a pre-call type check so an actionable exception is raised before work items are queued.
Example fix
// before
asyncManager.SaveAsXaml(unknownObject);
// after
if (unknownObject is FixedDocumentSequence || unknownObject is FixedDocument || unknownObject is FixedPage)
asyncManager.SaveAsXaml(unknownObject);
else
throw new NotSupportedException($"No XPS serializer for {unknownObject?.GetType().FullName}"); Defensive patterns
Strategy: type-guard
Validate before calling
if (!(obj is FixedDocumentSequence || obj is FixedDocument || obj is FixedPage))
throw new ArgumentException("Async SaveAsXaml requires a Fixed* type"); Type guard
static bool HasXpsSerializer(object o) => o is FixedDocumentSequence or FixedDocument or FixedPage;
Try / catch
try { asyncManager.SaveAsXaml(obj); }
catch (XpsSerializationException ex) when (ex.Message.Contains("NoSerializer")) { /* log type name of queued object */ } Prevention
- Validate object types before calling the async API
- Do not push arbitrary DependencyObjects into the async save pipeline
- Prefer the sync manager's diagnostics to identify unsupported types first
When it happens
Trigger: Async SaveAsXaml invoked with an object type for which the serializer registry lookup fails — typically a non-Fixed* type pushed through the async work-item path.
Common situations: Queuing custom document parts to the async pipeline; type mismatches after refactoring (e.g. passing a FixedPage where the manager expected a FixedDocument context).
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
- Serialization of this type of object is not supported.
- SR.ReachSerialization_NoSerializer
- SR.ReachSerialization_NotSupported
- Cannot find the appropriate serializer.
- Serialization of this type of object is not supported.
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/373f08286e8ae7cb.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/manager/NGCSerializationManagerAsync.cs:128
if(reachSerializer != null)
{
//
// Prepare the context that is going to be pushed on the stack
//
SerializationManagerOperationContextStack
contextStack = new SerializationManagerOperationContextStack(reachSerializer,
serializedObject);
//
// At this stage, start calling another method which would peak at the stack
//
_operationStack.Push(contextStack);
PostSerializationTask(new DispatcherOperationCallback(InvokeSaveAsXamlWorkItem));
}
else
{
throw new XpsSerializationException(SR.ReachSerialization_NoSerializer);
}
}
}
internal
Object
InvokeSaveAsXamlWorkItem(
Object arg
)
{
try
{
if(!_serializationOperationCanceled)
{
if(_operationStack.Count > 0)
{
Object objectOnStack = _operationStack.Pop();
View on GitHub (pinned to 81131a70a4)