Skip to content

[feature/damAnalyzer] Warning code differ between the linker and analyzer #2583

Closed
@LakshanF

Description

@LakshanF

The following code generates the warning IL2077 in the linker and IL2067 in the analyzer.

Impacts test SuppressWarningsInCompilerGeneratedCode

REPRO
Program.txt

Linker Warning
...Program.cs(21,5): Trim analysis warning IL2077: Mono.Linker.Tests.Cases.Warnings.WarningSuppression.SuppressWarningsInCompilerGeneratedCode.SuppressInIteratorBody.<TestMethodParameterWithRequirements>d__1.MoveNext(): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'Mono.Linker.Tests.Cases.Warnings.WarningSuppression.DataFlowTypeExtensions.RequiresNonPublicMethods(Type)'. The field 'System.Type Mono.Linker.Tests.Cases.Warnings.WarningSuppression.SuppressWarningsInCompilerGeneratedCode/SuppressInIteratorBody/<TestMethodParameterWithRequirements>d__1::unknownType' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

Analyzer Warning
 ```
ILLink.RoslynAnalyzer.Tests.DynamicallyAccessedMembersAnalyzerTests.TestWarnings
 Duration: 2.6 sec

Message: 
System.InvalidOperationException : Mismatch between number of diagnostics returned, expected "0" actual "1"

Diagnostics:
// (23,5): warning IL2067: 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.NonPublicMethods' in call to 'Mono.Linker.Tests.Cases.Warnings.WarningSuppression.DataFlowTypeExtensions.RequiresNonPublicMethods(Type)'. The parameter 'unknownType' of method 'Mono.Linker.Tests.Cases.Warnings.WarningSuppression.SuppressWarningsInCompilerGeneratedCode.SuppressInIteratorBody.TestMethodParameterWithRequirements(Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions