Skip to content

Conversation

@MihaZupan
Copy link
Member

Overlaps special-cases empty spans as not overlapping even if the pointer appears in the middle.
In this case, the LocalPath test exercises the UriFormat.Unescaped code path.

@MihaZupan MihaZupan added this to the 11.0.0 milestone Jan 11, 2026
@MihaZupan MihaZupan self-assigned this Jan 11, 2026
Copilot AI review requested due to automatic review settings January 11, 2026 16:06
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a debug assertion failure that occurs when processing URIs with empty paths in the UriFormat.Unescaped code path. The issue arises because the Overlaps method can incorrectly report that an empty span doesn't overlap with a buffer, even though the operation is valid.

Changes:

  • Modified debug assertion in Uri.cs to handle empty spans correctly
  • Added test assertions to verify AbsolutePath and LocalPath properties for an FTP URI with a compressed path

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/libraries/System.Private.Uri/src/System/Uri.cs Fixed debug assertion to check if span is empty before calling Overlaps
src/libraries/System.Private.Uri/tests/FunctionalTests/UriRelativeResolutionTest.cs Added test assertions to exercise the UriFormat.Unescaped code path with an empty path

@MihaZupan MihaZupan merged commit c637246 into dotnet:main Jan 12, 2026
94 of 97 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants