Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 29, 2025

This PR adds comprehensive breaking change documentation for the behavioral change in System.IO.Packaging where package part URIs are now compared case-insensitively in .NET 8, aligning with the Open Packaging Conventions (OPC) specification and .NET Framework behavior.

What Changed

In .NET 8, System.IO.Packaging now performs case-insensitive URI comparisons using StringComparison.OrdinalIgnoreCase instead of the previous case-sensitive behavior. This change:

  • Fixes content type override failures when casing differed between part URIs and override entries
  • Ensures non-compliant packages with duplicate entries differing only by case (e.g., /part and /PART) are properly rejected
  • Aligns behavior with both the OPC specification requirements and existing .NET Framework implementation

Documentation Added

  • Breaking change document: /docs/core/compatibility/core-libraries/8.0/system-io-packaging-case-insensitive-uri.md with complete details on the behavioral change, impact, and recommended actions
  • TOC entry: Added to /docs/core/compatibility/toc.yml in the appropriate .NET 8 Core .NET libraries section
  • Index entry: Added to /docs/core/compatibility/8.0.md categorized as a behavioral change

The documentation follows the established breaking change template and includes proper API cross-references for the affected methods:

  • System.IO.Packaging.Package.GetPart(Uri)
  • System.IO.Packaging.Package.CreatePart(Uri, string)

Impact on Developers

Developers using System.IO.Packaging should ensure their OPC packages don't contain part names differing only by case, as this violates the OPC specification. For packages that do violate the spec, the documentation provides guidance on using ZIP archives directly to access conflicting entries when needed.

Fixes #486221 (associated workitem for dotnet/runtime#112783)

Original prompt

This section details on the original issue you should resolve

<issue_title>[Breaking change]: Package part URIs are now compared case-insensitively in System.IO.Packaging</issue_title>
<issue_description>### Description

Previously, part names and overrides that differed only by ASCII case (e.g. /part vs /PART) were not considered equivalent, even though the Open Packaging Conventions (OPC) specification requires case-insensitive equivalence (§7.2.3.5, ECMA-376).
This change fixes the bug reported in dotnet/runtime#112783
and brings .NET 5–9 in line with both .NET Framework and the OPC spec.

Version

.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 (e.g. /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

  • Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • Behavioral change: Existing binaries might behave differently at run time.

Reason for 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.

Prevents ambiguous lookups and ensures consistent results.

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 spec:

  • 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.

Feature area

Core .NET libraries

Affected APIs

System.IO.Packaging.Package.GetPart(Uri)
System.IO.Packaging.Package.CreatePart(Uri, string)


Associated WorkItem - 486221</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #48174

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Internal previews

📄 File 🔗 Preview link
docs/core/compatibility/8.0.md docs/core/compatibility/8.0
docs/core/compatibility/core-libraries/8.0/system-io-packaging-case-insensitive-uri.md docs/core/compatibility/core-libraries/8.0/system-io-packaging-case-insensitive-uri
docs/core/compatibility/toc.yml docs/core/compatibility/toc

…itive URI comparison in .NET 8

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] [Breaking change]: Package part URIs are now compared case-insensitively in System.IO.Packaging Add breaking change documentation for System.IO.Packaging case-insensitive URI comparison in .NET 8 Sep 29, 2025
@Copilot Copilot AI requested a review from gewarren September 29, 2025 17:20
Copilot finished work on behalf of gewarren September 29, 2025 17:20
@gewarren gewarren marked this pull request as ready for review September 29, 2025 20:22
@gewarren gewarren requested a review from a team as a code owner September 29, 2025 20:22
@gewarren gewarren merged commit 3b4ddd8 into main Sep 30, 2025
13 checks passed
@gewarren gewarren deleted the copilot/fix-ab5b07e1-8cee-41f6-8903-4fb1056878ab branch September 30, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants