-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Remove unnecessary Unsafe.As call from StringValues #112507
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Tagging subscribers to this area: @dotnet/area-extensions-primitives |
Other Unsafe.As look also a bit unnecessary there as well, cast from mov rcx, 0x7FF89056B608 ; System.String[]
cmp qword ptr [rax], rcx
je SHORT G_M23900_IG07 |
/ba-g the server2025 failures were due to an ES rollout |
@EgorBo I agree it would be worth changing that as part of a larger effort to remove use of unsafe code where it's not giving a meaningful benefit. But I figured this one-line change would be uncontroversial because the use of unsafe code in this instance can be shown to provide zero benefit. :) |
I would not be surprised if changing this to a real cast showed up on ASP.NET benchmarks, as I understand this to be on some critical paths. If it doesn't affect any ASP.NET benchmarks, sure, kill it. |
(Caught by static analysis.)
This is essentially calling
Unsafe.As<string>(string)
, which is a no-op. Remove the call toUnsafe.As
.