dotnet / dotnet/linker

Linker and Analyzer warning on unsupported type

Open
#2,603 1 comment 1 reaction 0 assignees View on GitHub
question
Dominant language
C#
Stars
392
Forks
128
Avg merge
2d 10h
Merged PRs (30d)
2

Description

The set of warnings:
- DynamicallyAccessedMembersIsNotAllowedOnMethods (IL2041)
- DynamicallyAccessedMembersOnFieldCanOnlyApplyToTypesOrStrings (IL2097)
- DynamicallyAccessedMembersOnMethodParameterCanOnlyApplyToTypesOrStrings (IL2098)
- DynamicallyAccessedMembersOnPropertyCanOnlyApplyToTypesOrStrings (IL2099)
- DynamicallyAccessedMembersOnMethodReturnValueCanOnlyApplyToTypesOrStrings (IL2106)

Verify that DynamicallyAccessedMembers is not being used in an unsupported. To do this both tools check for DynamicallyAccessedMemberTypes not being None. In the following case:
```c#
public class ClassWithUnsupportedField {
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.None)]
static object _annotationOnWrongType;
}
```
The field _annotationOnWrongType has directly a DynamicallyAccessedMemberTypes.None annotation, but is bypassed by both linker and analyzer. The objective of this issue is to discuss if this use case should generate the unsupported type warning.

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.