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] Report DAM warnings for generics in all cases #2364
This is a tracking issue for support for annotated generics in the analyzer. The DAM analyzer only validates annotations for generics at callsites to generic methods:
This needs to be extended to cover all type references which may reference generic instantiations, including:
base/interface types of a type declaration
variable declarations
field/property/event declarations
parameter/return types of methods
This is probably best done using the symbol-based callbacks (RegisterSymbolAction) rather than the IOperation-based ones.
I would start by enabling some of the tests in GenericParameterDataFlow (or temporarily copying them to DynamicallyAccessedMembersAnalyzerTests.cs if that's easier). For example DerivedTypeWithOpenGenericOnBase looks like a good starting point.
Per @agocke's suggestion it might be better to do this using the syntax APIs which would likely cover all of the above cases (whereas using the symbol APIs would only get you callbacks for the symbol declarations and would require a separate approach for handling references to substituted generics inside method bodies).
#2574 tracks the remaining work to get validation of array types passed as generic parameters. I think all of the other cases are now covered by #2478 so I will close this issue.
Activity
sbomer commentedon Nov 19, 2021
Per @agocke's suggestion it might be better to do this using the syntax APIs which would likely cover all of the above cases (whereas using the symbol APIs would only get you callbacks for the symbol declarations and would require a separate approach for handling references to substituted generics inside method bodies).
sbomer commentedon Feb 1, 2022
#2574 tracks the remaining work to get validation of array types passed as generic parameters. I think all of the other cases are now covered by #2478 so I will close this issue.