Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Previously, part names and overrides that differed only by ASCII case (for example, /part vs /PART) were not considered equivalent in System.IO.Packaging, even though the Open Packaging Conventions (OPC) specification requires case-insensitive equivalence (§7.2.3.5, ECMA-376). This change fixes the bug and brings .NET 5–9 in line with both .NET Framework and the OPC specification.
Version introduced
.NET 8
Previous behavior
URI comparisons were case-sensitive.
Content type overrides failed if the casing differed between the part URI and the override entry.
Some non-compliant packages containing duplicate entries differing only in case (for example, /part and /PART) could be loaded, leading to ambiguous results.
New behavior
URI comparisons are case-insensitive (StringComparison.OrdinalIgnoreCase). Overrides with different casing now work as expected. Non-compliant packages containing multiple entries that differ only by case are now rejected when opened. This aligns with .NET Framework and the OPC specification.
Type of breaking change
This is a behavioral change.
Reason for change
This change aligns System.IO.Packaging behavior with:
- The OPC specification (case-insensitive URI equivalence is mandatory).
- Existing .NET Framework behavior, which already enforces case-insensitive matching.
It prevents ambiguous lookups and ensures consistent results, and fixes dotnet/runtime#112783.
Recommended action
Ensure that OPC packages do not contain part names differing only by case, as this is invalid per the OPC specification.
If consuming packages that violate the specification:
- Contact the package author to fix the package.
- If you need to read or inspect the contents, you can open the package as a ZIP archive. Unlike the Package API, ZIP archives do not enforce OPC rules and will allow you to access all entries, including those with conflicting case names.