Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

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

Closed

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.

Activity

  1. self-assigned this
    on Feb 4, 2022
  2. tlakollo commented on Feb 16, 2022

    @tlakollo
    Contributor

    closed via #2584

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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