Skip to content

Add deprecation warning to Uri.UserEscaped property documentation #11467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 18, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 18, 2025

The Uri.UserEscaped property documentation was missing a deprecation warning, causing confusion for developers who might expect it to work as originally designed.

Problem:
The Uri.UserEscaped property references the dontEscape parameter from Uri constructors, which has been obsolete since .NET Framework 4. The constructor parameter is now always treated as false, meaning UserEscaped will always return false, but the documentation didn't clearly indicate this deprecated behavior.

Solution:
Added a prominent [!CAUTION] warning box to the property documentation that:

  • Clearly states this represents deprecated functionality that won't work as expected
  • Explains that the dontEscape parameter has been deprecated since .NET Framework 4 and always returns false
  • Warns developers not to use this property to determine URI escaping behavior
  • Preserves the original documentation for historical context

Example of the warning:

Caution

The Uri.UserEscaped property represents deprecated functionality that will not work as expected. The dontEscape parameter referenced by this property has been deprecated since .NET Framework 4 and will always be false. As a result, this property will always return false and should not be used to determine URI escaping behavior.

This follows the same deprecation warning pattern used elsewhere in the codebase (similar to Uri.DnsSafeHost property deprecation).

Fixes #11436.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Uri.UserEscaped contains deprecated information without warning Add deprecation warning to Uri.UserEscaped property documentation Jun 18, 2025
@Copilot Copilot AI requested a review from gewarren June 18, 2025 12:31
Copilot finished work on behalf of gewarren June 18, 2025 12:31
@gewarren gewarren marked this pull request as ready for review June 18, 2025 13:12
@gewarren gewarren requested a review from a team as a code owner June 18, 2025 13:12
@gewarren gewarren enabled auto-merge (squash) June 18, 2025 13:12
@MihaZupan
Copy link
Member

MihaZupan commented Jun 18, 2025

Related: dotnet/runtime#56840

The existing obsoletion message is also misleading.

This constructor has been deprecated; the dontEscape parameter is always false.

The argument still does something. new Uri("http://foo", true).UserEscaped still returns true.

@copilot Can we remove the the dontEscape parameter is always false part and have it be just "This constructor has been deprecated. Use ... instead."?
For this property I'd remove the mention of "always false" and just say it's deprecated, don't use it.

@gewarren gewarren requested a review from MihaZupan June 18, 2025 14:08
…tion

Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jun 18, 2025

Related: dotnet/runtime#56840

The existing obsoletion message is also misleading.
...

You're absolutely right about the misleading "always false" claim. I've removed that language from the property documentation to avoid confusion. The documentation now simply states that the property is deprecated without making incorrect behavioral claims. See commit f440f4b.

@Copilot Copilot AI requested a review from gewarren June 18, 2025 14:11
Copilot finished work on behalf of gewarren June 18, 2025 14:11
Copy link
Member

@MihaZupan MihaZupan left a comment

Choose a reason for hiding this comment

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

Thank you

@MihaZupan MihaZupan merged commit b3fdab4 into main Jun 18, 2025
5 checks passed
@MihaZupan MihaZupan deleted the copilot/fix-11436 branch June 18, 2025 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uri.UserEscaped contains deprecated information without warning
3 participants