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

Warning origins for warnings originating from event accessors are very confusing #100499

Closed
vitek-karas opened this issue Aug 19, 2021 · 1 comment · Fixed by #102528
Closed
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers
Milestone

Comments

@vitek-karas
Copy link
Member

Currently MarkEvent will directly call MarkMethod(add_event) and MarkMethod(remove_Event) with the origin set to the event itself. So for example:

// IL2026 - about the add_event
public event EventHandler TestEvent {
    [RequiresUnreferencedCode()]
    add {}
}

The warning is reported on the event itself and not on the callsite actually accessing the event. It's also reported repeatedly (if there are multiple callsites).

This gets potentially even worse because ProcessEvent(add_event) will call MarkEvent(event) and so that will potentially trigger the warning multiple times on its own.

RUC on type makes this even worse since both accessors are automatically RUC and this loops on itself (I think I saw the warning triplicated and on the wrong place).

@tommcdon
Copy link
Member

tommcdon commented Apr 9, 2024

@sbomer This issue was incorrectly assigned to area-tracing, could you help us find the right area path for this issue?

@sbomer sbomer added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Apr 9, 2024
@sbomer sbomer removed the area-Meta label Apr 9, 2024
@sbomer sbomer added this to the 9.0.0 milestone Apr 25, 2024
@sbomer sbomer removed the untriaged New issue has not been triaged by the area owner label Apr 25, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 22, 2024
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
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants