-
Notifications
You must be signed in to change notification settings - Fork 5k
Change GetParametersNoCopy to GetParametersAsSpan and use it in a few more places #92310
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
Conversation
Tagging subscribers to this area: @dotnet/area-system-reflection Issue DetailsThe internal GetParametersNoCopy avoids a defensive ParameterInfo[] copy, but it requires the callers to promise not to mutate the array. I'm changing the method to return a
|
Nit: Existing art
|
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.
Thanks!
src/libraries/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs
Show resolved
Hide resolved
… more places The internal GetParametersNoCopy avoids a defensive ParameterInfo[] copy, but it requires the callers to promise not to mutate the array. I'm changing the method to return a `ReadOnlySpan<ParameterInfo>`, which means a caller can't mutate it without using unsafe code, and enabling the compiler to flag any misuse. I've then used it in a few more places. We might subsequently want to consider exposing it publicly.
4513e90
to
8f6db68
Compare
src/libraries/Common/src/System/Runtime/InteropServices/ComEventsMethod.cs
Outdated
Show resolved
Hide resolved
/azp list |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
Both failures are known and tracked. I ran extra platforms as well, and all of those also appear to be known, with the exception of some recently added LINQ tests failing on nativeaot for which I opened an issue. |
The internal GetParametersNoCopy avoids a defensive ParameterInfo[] copy, but it requires the callers to promise not to mutate the array. I'm changing the method to return a
ReadOnlySpan<ParameterInfo>
, which means a caller can't mutate it without using unsafe code, and enabling the compiler to flag any misuse. I've then used it in a few more places. We might subsequently want to consider exposing it publicly.