dotnet/wpf · error · InvalidDataException

SR.ReachPackaging_MoreThanOneStartingParts

Error message

SR.ReachPackaging_MoreThanOneStartingParts

What it means

While resolving the FixedDocumentSequence (starting part), XpsManager iterates package relationships of type ReachPackageStartingPartRelationshipType. If more than one starting-part relationship exists, InvalidDataException(SR.ReachPackaging_MoreThanOneStartingParts) is thrown; an XPS package must designate exactly one starting part (FixedDocumentSequence).

Solutions

  1. Open the package and remove all but one relationship of type ReachPackageStartingPartRelationshipType from the root relationships.
  2. Re-save/normalize the package with a conformant producer (e.g. re-print or re-serialize it).
  3. Fix the writer code that creates the starting-part relationship to create it only once.
Defensive patterns

Strategy: try-catch

Try / catch

catch (InvalidDataException) { /* more than one starting-part relationship: normalize the package or reject it */ }

Prevention

When it happens

Trigger: Opening an XPS package that declares two or more root relationships with the starting-part relationship type — a spec-violating package produced by a buggy writer or manual package editing.

Common situations: Buggy third-party XPS generators; copying the FixedDocumentSequence relationship when cloning a package; hand-modifying the ZIP's _rels/.rels file.

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


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsManager.cs:1415

        /// <returns>
        /// PackagingPart instance of starting part.
        /// </returns>
        internal
        static
        PackagePart
        GetXpsDocumentStartingPart(
            Package         package
            )
        {
            Debug.Assert(package != null, "package cannot be null");
            PackageRelationship startingPartRelationship = null;
            PackagePart startingPart = null;

            foreach (PackageRelationship rel in package.GetRelationshipsByType(XpsS0Markup.ReachPackageStartingPartRelationshipType))
            {
                if (startingPartRelationship != null)
                {
                    throw new InvalidDataException(SR.ReachPackaging_MoreThanOneStartingParts);
                }

                startingPartRelationship = rel;
            }

            if (startingPartRelationship != null)
            {
                Uri startPartUri = PackUriHelper.ResolvePartUri(startingPartRelationship.SourceUri, 
                                                                startingPartRelationship.TargetUri);

                if (package.PartExists(startPartUri))
                {
                    startingPart = package.GetPart(startPartUri);
                }
            }

            return startingPart;
        }

View on GitHub (pinned to 81131a70a4)