{"record":{"id":"b437b31f5bf18f1b","repo":"dotnet/wpf","slug":"sr-reachpackaging-morethanonemetadataparts","errorCode":null,"errorMessage":"SR.ReachPackaging_MoreThanOneMetaDataParts","messagePattern":"SR\\.ReachPackaging_MoreThanOneMetaDataParts","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsManager.cs","lineNumber":1250,"sourceCode":"            //\n            if (!_contentTypes.ContainsKey(key))\n            {\n                _contentTypes[key] = 1;\n            }\n\n            return key;\n        }\n\n        private\n        PackageRelationship\n        GetDocumentPropertiesReationship()\n        {\n            PackageRelationship propertiesPartRelationship = null;\n            foreach (PackageRelationship rel in _metroPackage.GetRelationshipsByType(XpsS0Markup.CorePropertiesRelationshipType))\n            {\n                if (propertiesPartRelationship != null)\n                {\n                    throw new InvalidDataException(SR.ReachPackaging_MoreThanOneMetaDataParts);\n                }\n\n                propertiesPartRelationship = rel;\n            }\n            return propertiesPartRelationship;\n        }\n\n        private\n        void\n        AddPackageToCache(Uri uri, Package package )\n        {\n            lock (_globalLock)\n            {\n                _packageCache[uri] = 1;\n            }\n            PackageStore.AddPackage( uri, package );\n        }\n","sourceCodeStart":1232,"sourceCodeEnd":1268,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsManager.cs#L1232-L1268","documentation":"When opening an XPS package, XpsManager scans package relationships of type CorePropertiesRelationshipType to find the single CoreDocumentProperties part. If more than one such relationship exists, InvalidDataException(SR.ReachPackaging_MoreThanOneMetaDataParts) is thrown because the OPC/XPS spec permits at most one core properties part per package.","triggerScenarios":"Opening a package whose root contains two or more package-level relationships of the core-properties relationship type — usually the result of a corrupted or hand-edited package, or a tool that appended metadata without removing the old relationship.","commonSituations":"Third-party tools producing invalid XPS/OPC packages; merging packages and keeping both metadata relationships; manually editing the package ZIP and duplicating core properties entries.","solutions":["Open the package as a ZIP/OpcPackage and delete the duplicate core-properties relationships so only one remains.","Regenerate the XPS file with a conformant producer.","If you own the writing code, ensure the previous core-properties relationship is removed before adding a new one."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (InvalidDataException) { /* package has duplicate core-properties relationships: repair or reject the file */ }","preventionTips":["Never add a core-properties relationship without removing an existing one.","Validate third-party-produced packages before processing.","Don't hand-edit package ZIP structures."],"tags":["xps","opc","metadata","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"}