-
Notifications
You must be signed in to change notification settings - Fork 5k
Fix dataflow annotations on TypeExtensions
#116008
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
There was a leftover use of `.All` on some `EditorBrowsable.Never` APIs.
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.
Pull Request Overview
This PR fixes the incorrect dataflow annotations on several EditorBrowsable.Never APIs in TypeExtensions by replacing the broad All flag with explicit combinations of public and nonpublic member flags.
- Replaces DynamicallyAccessedMemberTypes.All with explicit combinations on GetMember.
- Updates the same annotations in the ref file for consistency.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/libraries/System.Reflection.TypeExtensions/src/System/Reflection/TypeExtensions.cs | Replaced the All member annotation with an explicit set of member types for GetMember and GetMembers. |
src/libraries/System.Reflection.TypeExtensions/ref/System.Reflection.TypeExtensions.cs | Updated the annotations to match the implementation changes in the source file. |
@@ -168,7 +168,13 @@ public static MemberInfo[] GetMember( | |||
|
|||
[EditorBrowsable(EditorBrowsableState.Never)] | |||
public static MemberInfo[] GetMember( | |||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] this Type type, | |||
[DynamicallyAccessedMembers( |
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.
[nitpick] Consider adding a brief inline comment explaining why the explicit set of DynamicallyAccessedMemberTypes is used here instead of All. This will help maintain clarity on the dataflow annotation requirements.
Copilot uses AI. Check for mistakes.
@@ -104,11 +104,11 @@ public static partial class TypeExtensions | |||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] | |||
public static System.Reflection.MemberInfo[] GetMember([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] this System.Type type, string name) { throw null; } | |||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] | |||
public static System.Reflection.MemberInfo[] GetMember([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] this System.Type type, string name, System.Reflection.BindingFlags bindingAttr) { throw null; } | |||
public static System.Reflection.MemberInfo[] GetMember([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] this System.Type type, string name, System.Reflection.BindingFlags bindingAttr) { throw null; } |
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.
[nitpick] Consider including a comment on the rationale behind splitting the annotation flags. This documentation will support future maintainers in understanding the change from using All to the explicit combination.
Copilot uses AI. Check for mistakes.
Tagging subscribers to this area: @dotnet/area-system-reflection |
There was a leftover use of
.All
on someEditorBrowsable.Never
APIs.Cc @dotnet/illink