Skip to content
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

Simplify analyzer handling of properties/events #92449

Merged
merged 4 commits into from
Sep 22, 2023
Merged

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Sep 22, 2023

Previously, the analyzer was effectively visiting referenced properties twice for each reference - it would visit both the referenced get/set method, and the property itself.

This change only visits the get/set method, and handles the property warnings there by treating the getter/setter as annotated when the property is annotated. This also allows some simplification of the override checking logic. Events get the same treatment.

Fixes #83235

Previously this was effectively visiting referenced properties twice for each reference - it would visit both the referenced get/set method, and the property itself.

This change only visits the get/set method, and handles the property warnings there by treating the getter/setter as annotated when the property is annotated.

This also allows some simplification of the override checking logic.
Equivalent warnings are now reported on the get/set methods.
@ghost ghost added the linkable-framework Issues associated with delivering a linker friendly framework label Sep 22, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Sep 22, 2023
@ghost ghost assigned sbomer Sep 22, 2023
@ghost
Copy link

ghost commented Sep 22, 2023

Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr, @marek-safar
See info in area-owners.md if you want to be subscribed.

Issue Details

Previously, the analyzer was effectively visiting referenced properties twice for each reference - it would visit both the referenced get/set method, and the property itself.

This change only visits the get/set method, and handles the property warnings there by treating the getter/setter as annotated when the property is annotated. This also allows some simplification of the override checking logic. Events get the same treatment.

Fixes #83235

Author: sbomer
Assignees: -
Labels:

linkable-framework, area-Tools-ILLink

Milestone: -

Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

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

Thanks!

@sbomer sbomer merged commit 3eba4e0 into dotnet:main Sep 22, 2023
59 checks passed
@ghost ghost locked as resolved and limited conversation to collaborators Oct 22, 2023
@sbomer sbomer deleted the propertyFix branch November 3, 2023 18:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ILLink analyzer handling of IL3003 on properties and events
2 participants