Consider rewording warnings around DAM to not mention reflection access
- Dominant language
- C#
- Stars
- 392
- Forks
- 128
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 2
Description
With the following program:
```c#
class Program
{
public static void Main()
{
Foo(typeof(Program));
Bar(typeof(Program));
}
public static void Foo([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type type)
=> Console.WriteLine("Foo");
public static void Bar([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
=> Console.WriteLine("Bar");
}
```
... the following linker warnings are emitted (dotnet SDK 6.0.101):
```
/home/roji/projects/test/Program.cs(13,9): Trim analysis warning IL2111: Program.Main(): Method 'Program.Foo(Type)' with parameters or return value with `DynamicallyAccessedMembersAttribute` is accessed via reflection. Trimmer can't guarantee availability of the requirements of the method. [/home/roji/projects/test/Test.csproj]
/home/roji/projects/test/Program.cs(13,9): Trim analysis warning IL2111: Program.Main(): Method 'Program.Bar(Type)' with parameters or return value with `DynamicallyAccessedMembersAttribute` is accessed via reflection. Trimmer can't guarantee availability of the requirements of the method. [/home/roji/projects/test/Test.csproj]
```
... although there's no reflection involved.
Curiously, when commenting out the call to Bar, both warnings disappear.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.