You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
[DAM analyzer] don't produce dataflow warnings for compiler-generated code #2587
This issue tracks temporarily disabling dataflow warnings in the analyzer for compiler-generated code, until the linker better understands compiler-generated code.
Because the linker sees compiler-generated code for lambdas/iterators/async/local functions, it produces different dataflow warnings than those naturally produced by the analyzer. In particular, parameters and locals which are lifted to fields of state machines will show up as IL2077, whereas the linker will produce IL2066 for parameters.
Until the linker is fixed to produce the correct warnings for compiler-generated code, we would like the analyzer not to produce any warnings for these patterns. (This seems better than the alternative of producing slightly different warning codes for the same pattern, which would create usability issues - people would add annotations according to the analyzer warnings, but would get a completely different set when actually linking).
The below table lists the test scenarios and the analyzer and linker behavior. As the table shows, rows 5 and 12, have analyzer generating different warnings (IL2067 to linker's IL2077). Currently local Functions and Lambdas are impacted by dotnet/runtime#84918 and do not produce the necessary warnings.
<style>
</style>
Row
Category
Subcategory
Notes
Method
Suppression
Trimmer
Analyzer
1
SuppressInIteratorBody
Direct Call
RUC
TestCallRUCMethod
2026
No Warning
No Warning
2
SuppressInIteratorBody
Intrisics
RUC
TestReflectionAccessRUCMethod
2026
No Warning
No Warning
3
SuppressInIteratorBody
Lambda
RUC
TestLdftnOnRUCMethod
2026
No Warning
No Warning
4
SuppressInIteratorBody
DF - DAMT.NonPublic
Type member annotated with RUC
TestDynamicallyAccessedMethod
2026
No Warning
No Warning
5
SuppressInIteratorBody
DF - DAMT.NonPublic
Type is null
TestMethodParameterWithRequirements
2077
No Warning
2067
6
SuppressInIteratorBody
DF - GenericParameter
Method
TestGenericMethodParameterRequirement
2091
No Warning
No Warning
7
SuppressInIteratorBody
DF - GenericParameter
Type
TestGenericTypeParameterRequirement
2091
No Warning
No Warning
8
SuppressInAsyncBody
Direct Call
RUC
TestCallRUCMethod
2026
No Warning
No Warning
9
SuppressInAsyncBody
Intrisics
RUC
TestReflectionAccessRUCMethod
2026
No Warning
No Warning
10
SuppressInAsyncBody
Lambda
RUC
TestLdftnOnRUCMethod
2026
No Warning
No Warning
11
SuppressInAsyncBody
DF - DAMT.NonPublic
Type member annotated with RUC
TestDynamicallyAccessedMethod
2026
No Warning
No Warning
12
SuppressInAsyncBody
DF - DAMT.NonPublic
Type is null
TestMethodParameterWithRequirements
2077
No Warning
2067
13
SuppressInAsyncBody
DF - GenericParameter
Method
TestGenericMethodParameterRequirement
2091
No Warning
No Warning
14
SuppressInAsyncBody
DF - GenericParameter
Type
TestGenericTypeParameterRequirement
2091
No Warning
No Warning
15
SuppressInLocalFunction
Direct Call
RUC
TestCallRUCMethod
2026
Warning in local Fn
No Warning
16
SuppressInLocalFunction
Intrisics
RUC
TestReflectionAccessRUCMethod
2026
Warning in local Fn
No Warning
17
SuppressInLocalFunction
Lambda
RUC
TestLdftnOnRUCMethod
2026
Warning in local Fn
No Warning
18
SuppressInLocalFunction
DF - DAMT.NonPublic
Type member annotated with RUC
TestDynamicallyAccessedMethod
2026
Warning in local Fn
No Warning
19
SuppressInLocalFunction
DF - DAMT.NonPublic
Type is null
TestMethodParameterWithRequirements
2077
Warning in local Fn
No Warning
20
SuppressInLocalFunction
DF - GenericParameter
Method
TestGenericMethodParameterRequirement
2091
Warning in local Fn
No Warning
21
SuppressInLocalFunction
DF - GenericParameter
Type
TestGenericTypeParameterRequirement
2091
Warning in local Fn
No Warning
22
SuppressInLocalFunction
DF - GenericParameter
Local Fn has DAMT on T
TestGenericLocalFunction
2091
No Warning
No Warning
23
SuppressInLocalFunction
DF - GenericParameter
Local Fn has calls to DAMT methods
TestGenericLocalFunctionInner
2087
Warning in local Fn
No Warning
24
SuppressInLocalFunction
DF - GenericParameter
Parent has correct DAMT annotation & local calls DAMT methods
TestGenericLocalFunctionWithAnnotations
None
No Warning
No Warning
25
SuppressInLocalFunction
DF - GenericParameter
Parent & local has correct DAMT annotation & local calls DAMT methods
TestGenericLocalFunctionWithAnnotationsAndClosure
None
No Warning
No Warning
26
SuppressInLocalFunction
Lambda
RUC - local fun is created as a lambda!
TestCallRUCMethodInLtftnLocalFunction
2026
Warning in local Fn
No Warning
27
SuppressInLocalFunction
DF - DAMT.NonPublic
DF for a class where a method has a local fn that calls RUC
Activity
tlakollo commentedon Feb 5, 2022
Related to #2583
LakshanF commentedon Feb 15, 2022
We are planning to follow the following principles wrt analyzer warnings until the linker compiler generated work is done;
LakshanF commentedon Feb 15, 2022
The SuppressWarningsInCompilerGeneratedCode test has all the interesting test scenarios outlined in the "Handling of compiler generated code" document.
The below table lists the test scenarios and the analyzer and linker behavior. As the table shows, rows 5 and 12, have analyzer generating different warnings (IL2067 to linker's IL2077). Currently local Functions and Lambdas are impacted by dotnet/runtime#84918 and do not produce the necessary warnings.
<style> </style>