dotnet / dotnet/linker

Unnecessary marking methods for reflection calls with wrong binding flags

Open
#2,432 2 comments 0 reactions 0 assignees View on GitHub
area-Linker: DataFlow
Dominant language
C#
Stars
392
Forks
128
Avg merge
2d 10h
Merged PRs (30d)
2

Description

Reflection call like `GetMethod("Name", BindingFlags.Static)` will actually never return anything, one needs to specify `Public` or `NonPublic` on top of the `Static` to get something. Currently intrinsic handling doesn't recognize this if the name of the method is known and marks the method by name anyway.

This is not a correctness problem - it's OK to overmark. It's a size problem and it might cause reporting warnings which otherwise should not be reported (if the target method will cause warnings).

It's also very unlikely to happen, because the above call is basically useless, so it doesn't matter much.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.