dotnet/wpf · error · InvalidDataException
SR.ReachPackaging_MoreThanOneMetaDataParts
Error message
SR.ReachPackaging_MoreThanOneMetaDataParts
What it means
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.
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.
Defensive patterns
Strategy: try-catch
Try / catch
catch (InvalidDataException) { /* package has duplicate core-properties relationships: repair or reject the file */ } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
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
- SR.ReachPackaging_MoreThanOneStartingParts
- Document has more than one Signature Definition…
- Document has more than one Thumbnail relationship.
- Package must contain an XPS PackagePart.
- PackagePart has more than one Print Ticket relationship.
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/b437b31f5bf18f1b.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/ReachFramework/Packaging/XpsManager.cs:1250
//
if (!_contentTypes.ContainsKey(key))
{
_contentTypes[key] = 1;
}
return key;
}
private
PackageRelationship
GetDocumentPropertiesReationship()
{
PackageRelationship propertiesPartRelationship = null;
foreach (PackageRelationship rel in _metroPackage.GetRelationshipsByType(XpsS0Markup.CorePropertiesRelationshipType))
{
if (propertiesPartRelationship != null)
{
throw new InvalidDataException(SR.ReachPackaging_MoreThanOneMetaDataParts);
}
propertiesPartRelationship = rel;
}
return propertiesPartRelationship;
}
private
void
AddPackageToCache(Uri uri, Package package )
{
lock (_globalLock)
{
_packageCache[uri] = 1;
}
PackageStore.AddPackage( uri, package );
}
View on GitHub (pinned to 81131a70a4)