dotnet/wpf · error · XpsPackagingException
Not all opened dependents were committed.
Error message
Not all opened dependents were committed.
What it means
XpsInterleavingPolicy.ConfirmCommited (called during Flush) throws XpsPackagingException(SR.ReachPackaging_DependantsNotCommitted) when an interleaved dependent part that does not allow partial flush has not been committed. The interleaving policy requires all opened dependents to be committed before the package can be flushed.
Solutions
- Call Commit() on every open IXpsFixedPageWriter/FixedDocumentWriter before flushing/closing the XpsDocument.
- Ensure the document structure is completed in order (document → page → resources) so dependents get committed.
- On error paths, dispose/close writers deterministically (using blocks) so partially built pages are committed or discarded properly.
Example fix
// before
pageWriter.AddImage("image/png");
documentWriter.Commit(); // dependents not committed
// after
pageWriter.AddImage("image/png");
pageWriter.Commit();
documentWriter.Commit(); Defensive patterns
Strategy: try-catch
Validate before calling
bool allCommitted = openPages.All(p => p.IsCommitted);
if (!allCommitted) throw new InvalidOperationException("Commit all page writers before flush"); Try / catch
try { xpsDocument.Flush(); }
catch (XpsPackagingException ex) when (ex.Message.Contains("not committed")) { /* commit outstanding writers and retry */ } Prevention
- Always call Commit() on page/document writers inside using/finally blocks.
- Follow the XPS write order: document sequence → document → pages → Commit all → flush.
When it happens
Trigger: Calling XpsDocument flush/close while a FixedPage/FixedDocument writer opened via the interleaving policy still has uncommitted parts (n.Commited == false and IsPartialFlushAllowed(n) is false).
Common situations: Forgetting to call Commit on a page writer before flushing the document; exception paths that abandon a writer mid-way; streaming XPS where interleaved parts must be committed in order.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- " }} " element found. Expected fixed page element ( }} ).
- ' ' ContentType is not valid.
- ' ' ContentType is not valid.
- Buffer address passed to GetText cannot be NULL.
- Cannot convert from type.
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/1e83f3abf4bf264c.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsInterleavingPolicy.cs:527
//
// When a flushing only the document,
// the document sequence and the XpsDocument could still not
// be complete
//
private
void
ConfirmCommited()
{
foreach( InterleavingNode n in _interleavingNodes )
{
if(IsPartialFlushAllowed(n))
{
continue;
}
if( !n.Commited )
{
throw new XpsPackagingException(SR.ReachPackaging_DependantsNotCommitted);
}
}
}
/// <summary>
/// Tests wether a part can be flushed with out being committed
/// </summary>
private
bool
IsPartialFlushAllowed( InterleavingNode n )
{
bool ret = false;
if( n.Node is IXpsFixedDocumentWriter ||
n.Node is IXpsFixedDocumentSequenceWriter ||
n.Node is XpsDocument
)
{
ret = true;View on GitHub (pinned to 81131a70a4)