Skip to content

Conversation

@teo-tsirpanis
Copy link
Contributor

@teo-tsirpanis teo-tsirpanis commented Jan 5, 2025

This PR updates the implementation of AssemblyName.EscapeCodeBase to match the current implementation of UriHelper.EscapeString, after simplifying it to remove unneeded capabilities. As a result, the code has become simpler, more efficient, and no longer unsafe.

Related to #94941.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jan 5, 2025
@dotnet-policy-service
Copy link
Contributor

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

}

i += (count - 1);
Debug.Assert(stringToEscape.EnumerateRunes() is { } e && e.MoveNext() && e.Current == r);
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason for needing this assert?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied it from UriHelper.

Debug.Assert(stringToEscape.EnumerateRunes() is { } e && e.MoveNext() && e.Current == r);

Copy link
Contributor

@steveharter steveharter left a comment

Choose a reason for hiding this comment

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

LGTM; did a comparison to the original UriHelper

@steveharter
Copy link
Contributor

@teo-tsirpanis is this ready for merge?

@teo-tsirpanis
Copy link
Contributor Author

@steveharter yes.

@EgorBo
Copy link
Member

EgorBo commented Jan 31, 2025

@steveharter can we merge it then?

@steveharter steveharter merged commit 751acde into dotnet:main Feb 12, 2025
137 of 140 checks passed
@teo-tsirpanis teo-tsirpanis deleted the assembly-name-escape branch February 12, 2025 20:38
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Reflection community-contribution Indicates that the PR has been added by a community member reduce-unsafe

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants