{"record":{"id":"11b562e8ee9a5b84","repo":"dotnet/wpf","slug":"sr-reachpackaging-morethanonestartingparts","errorCode":null,"errorMessage":"SR.ReachPackaging_MoreThanOneStartingParts","messagePattern":"SR\\.ReachPackaging_MoreThanOneStartingParts","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsManager.cs","lineNumber":1415,"sourceCode":"        /// <returns>\n        /// PackagingPart instance of starting part.\n        /// </returns>\n        internal\n        static\n        PackagePart\n        GetXpsDocumentStartingPart(\n            Package         package\n            )\n        {\n            Debug.Assert(package != null, \"package cannot be null\");\n            PackageRelationship startingPartRelationship = null;\n            PackagePart startingPart = null;\n\n            foreach (PackageRelationship rel in package.GetRelationshipsByType(XpsS0Markup.ReachPackageStartingPartRelationshipType))\n            {\n                if (startingPartRelationship != null)\n                {\n                    throw new InvalidDataException(SR.ReachPackaging_MoreThanOneStartingParts);\n                }\n\n                startingPartRelationship = rel;\n            }\n\n            if (startingPartRelationship != null)\n            {\n                Uri startPartUri = PackUriHelper.ResolvePartUri(startingPartRelationship.SourceUri, \n                                                                startingPartRelationship.TargetUri);\n\n                if (package.PartExists(startPartUri))\n                {\n                    startingPart = package.GetPart(startPartUri);\n                }\n            }\n\n            return startingPart;\n        }","sourceCodeStart":1397,"sourceCodeEnd":1433,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsManager.cs#L1397-L1433","documentation":"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).","triggerScenarios":"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.","commonSituations":"Buggy third-party XPS generators; copying the FixedDocumentSequence relationship when cloning a package; hand-modifying the ZIP's _rels/.rels file.","solutions":["Open the package and remove all but one relationship of type ReachPackageStartingPartRelationshipType from the root relationships.","Re-save/normalize the package with a conformant producer (e.g. re-print or re-serialize it).","Fix the writer code that creates the starting-part relationship to create it only once."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (InvalidDataException) { /* more than one starting-part relationship: normalize the package or reject it */ }","preventionTips":["Create the starting-part relationship exactly once per package.","Validate package root relationships after generating XPS files.","Avoid copying _rels/.rels entries when cloning packages."],"tags":["xps","opc","starting-part","corrupt-package","wpf"],"backgroundTag":"schema-validation-failed","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}