-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Update C# code for #29448 #56086
base: main
Are you sure you want to change the base?
Update C# code for #29448 #56086
Conversation
357eca4
to
2c7a6f8
Compare
CI failures look legit. Probably need some |
I'm not an AOT expert, but isn't creating a new struct going to do basically the same thing in AOT as depending on |
From @stephentoub on #55611 (comment):
|
ValueTuple implements multiple interfaces and as a result contains a lot of code that generally can't be trimmed. If it's not otherwise used in the app, it's unnecessary bloat. At the app level, not a big deal, but at the runtime level, we pay attention to such things. |
There was a name collision between The other errors look to me as environmental and not related to this change. Am I missing anything? |
Nope, I was referring to the name collision. The new failure is probably unrelated, though it's not one I've seen before. A nuget restore failure could have been a transient network issue? |
@amcasey, all builds seem to have succeeded. |
All good, @BrennanConroy? |
Anything blocking this PR? |
This commit includes a significant refactor of the `UriHelper.cs` file. Unused namespaces `System.Buffers` and `System.Runtime.CompilerServices` have been removed. The `InitializeAbsoluteUriStringSpanAction` delegate and `InitializeAbsoluteUriString` method, as well as the `CopyTextToBuffer` method, have been removed. A new struct `UriComponents` has been introduced to encapsulate the components of a URI: `Scheme`, `Host`, `PathBase`, `Path`, `Query`, and `Fragment`. The `string.Create` method call has been updated to use a new lambda function that leverages the `UriComponents` struct to copy each component of the URI into the buffer, adjusting the buffer slice as needed. This function also handles the case where both `PathBase` and `Path` components have a slash, removing the trailing slash from `PathBase` to avoid duplication. Finally, the `BuildAbsolute` method has been updated to use the new `UriComponents` struct and the updated `string.Create` call.
ee9a23a
to
67f8239
Compare
Update C# code for #29448
Summary of the changes (Less than 80 chars)
Description
When #29448 was merged, there were no static lambdas in C# and AOT was not a thing.
A new struct
UriComponents
has been introduced to encapsulate the components of a URI:Scheme
,Host
,PathBase
,Path
,Query
, andFragment
to avoid a dependency onValueTuple{6}
. Thestring.Create
method call has been updated to use a new lambda function that leverages theUriComponents
struct to copy each component of the URI into the buffer, adjusting the buffer slice as needed. This function also handles the case where bothPathBase
andPath
components have a slash, removing the trailing slash fromPathBase
to avoid duplication.Finally, the
BuildAbsolute
method has been updated to use the newUriComponents
struct and the updatedstring.Create
call.Related to #29448 and #28905