Some data flow warning messages are backwards or hard to understand
- Dominant language
- C#
- Stars
- 392
- Forks
- 128
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 2
Description
The data flow warnings in general state a message like:
"The 'target' does not satisfy 'annotation'. The 'source' does not have matching annotation."
This is confusing in lot of places and the message warning is frequently plainly wrong.
For example
```C#
void RequiresPublicProperties([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type inputType) { }
Type typeField;
void Test()
{
// IL2077: 'inputType' argument does not satisfy 'PublicProperties' in call to 'RequiresPublicProperties'. The field 'typeField' does not have matching annotations.
RequiresPublicProperties(typeField);
}
```
This kind of reads backwards. The "offender" in this case is `typeField` because it doesn't fulfill the requirements on the `inputType` parameter. But the message starts by saying that the `inputType` does not satisfy requirements.
This is even worse in case where the field is the target:
```C#
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
Type fieldRequiresPublicMethods;
void Test()
{
// IL2074: value stored in field 'fieldRequiresPublicMethods' does not satisfy 'PublicMethods' requirements. The generic parameter 'TUnknown' of 'Test' does not have matching annotations.
fieldRequiresPublicMethods = typeof(TUnknown);
}
```
This is just incorrect. The value of the field is not even used in this case, instead it's being assigned to. So the field is the one with requirements and the generic parameter is the value which doesn't satisfy them.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.