dotnet/wpf · error · XpsPackagingException
PackagePart URI does not correspond to a FixedPage.
Error message
PackagePart URI does not correspond to a FixedPage.
What it means
XpsFixedDocumentReaderWriter.AddPageToCache throws XpsPackagingException (ReachPackaging_NotAFixedPage) when the part at the page URI exists but its validated content type (including sub-type) is not the XPS FixedPage content type. The part found via the relationship is not a FixedPage as required.
Solutions
- Correct the relationship target to point at a part with the FixedPage content type ('application/vnd.ms-package.xps-fixedpage').
- Fix the part's Content-Type metadata in the package if it is actually a FixedPage but mislabeled.
- Regenerate the package with standard XPS writing APIs instead of manual OPC manipulation.
- Validate the package structure with a validator before loading.
Defensive patterns
Strategy: validation
Validate before calling
var part = xpsManager.GetPart(pageUri);
if (part == null || !part.ValidatedContentType().AreTypeAndSubTypeEqual(XpsS0Markup.FixedPageContentType))
throw new Exception("URI is not a FixedPage: " + pageUri); Try / catch
try { ParsePages(); }
catch (XpsPackagingException ex) when (ex.Message.Contains("FixedPage")) { /* skip/repair mislabeled part */ } Prevention
- Ensure page relationships point only to FixedPage-typed parts.
- Use standard XPS writers to produce packages.
- Run a package validator before consumption.
When it happens
Trigger: A FixedDocument page relationship points to a part whose validated content type does not equal XpsS0Markup.FixedPageContentType (e.g. it is a FixedDocument, image, or arbitrary part).
Common situations: Hand-built or third-party-generated XPS packages with wrong relationship targets; parts labeled with wrong content types; bugs in XPS conversion tools.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- ' ' ContentType is not valid.
- PackagePart URI does not correspond to a FixedDocument.
- SR.InvalidDSContentType
- SR.InvalidSFContentType
- String passed for type is not valid.
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/8ad4fef6350ba9dc.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsFixedDocumentReaderWriter.cs:980
}
}
}
}
private
IXpsFixedPageReader
AddPageToCache( Uri pageUri )
{
PackagePart pagePart = CurrentXpsManager.GetPart(pageUri);
if (pagePart == null)
{
throw new XpsPackagingException(SR.ReachPackaging_PartNotFound);
}
if (!pagePart.ValidatedContentType().AreTypeAndSubTypeEqual(XpsS0Markup.FixedPageContentType))
{
throw new XpsPackagingException(SR.ReachPackaging_NotAFixedPage);
}
//
// Create the reader/writer for the part
//
IXpsFixedPageReader pageReader = new XpsFixedPageReaderWriter(CurrentXpsManager, this, pagePart, null, _pageCache.Count+1);
//
// Cache the new reader/writer for later
//
_pageCache.Add(pageReader );
return pageReader;
}
private
void
EnsureThumbnail()View on GitHub (pinned to 81131a70a4)