dotnet/wpf · error · XpsPackagingException
ReachPackaging_NotAFixedDocumentSequence
Error message
ReachPackaging_NotAFixedDocumentSequence
What it means
GetFixedDocumentSequence throws this XpsPackagingException when the part referenced as the root does not correspond to a FixedDocumentSequence — the starting part's content/URI resolves to something other than an .fdseq root, so a FixedDocumentSequence cannot be produced from it.
Solutions
- Ensure the package's starting part has the FixedDocumentSequence content type (.fdseq) before calling GetFixedDocumentSequence
- Call the appropriate reader method (GetFixedDocument / page APIs) for packages whose root is not a FixedDocumentSequence
- Catch XpsPackagingException and inspect the starting part content type to route to the right reader
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsDocument.cs:625 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/7f2994e28a272945.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsDocument.cs:625
ParserContext parserContext = new ParserContext
{
BaseUri = PackUriHelper.Create(Uri, CurrentXpsManager.StartingPart.Uri)
};
Uri packageUri = PackUriHelper.GetPackageUri(parserContext.BaseUri);
Uri previousPackageUri = XpsLoadingContext.ActivePackageUri;
// Establish XPS package context so that ambient-check sinks
// (BitmapImage, BitmapDecoder, ColorContext, FontSource, PixelShader)
// see the correct package origin during .fdseq parsing.
XpsLoadingContext.ActivePackageUri = packageUri;
try
{
object fixedObject = XamlReader.Load(CurrentXpsManager.StartingPart.GetStream(), parserContext, useRestrictiveXamlReader: true);
if (!(fixedObject is FixedDocumentSequence))
{
throw new XpsPackagingException(SR.ReachPackaging_NotAFixedDocumentSequence);
}
return fixedObject as FixedDocumentSequence;
}
finally
{
XpsLoadingContext.ActivePackageUri = previousPackageUri;
}
}
/// <summary>
/// This method commits the changes of the package and closes it.
/// Further changes after a commit will cause an exception to be
/// thrown.
/// </summary>
internal
override
voidView on GitHub (pinned to 81131a70a4)