Closed jcouv closed 5 years ago
Thanks @jcouv. This seems to be same as https://github.com/dotnet/csharplang/issues/2235#issuecomment-464308801. Current IOperation tree and ControlFlowGraph have no special operation node for using declaration, it is just an Operation.None node wrapping the variable declaration. This leads to all CFG and IOperation clients that attempt to analyze reads and writes to see a variable declaration, whose underlying declared local is never referenced. I believe this issue will get fixed once we implement IOperation and CFG support for this feature.
We have an open issue on this https://github.com/dotnet/roslyn/issues/32100 which should fix once implemented.
Closed as dupe of https://github.com/dotnet/roslyn/issues/32100. Copied scenario details over there
I suspect this is a compiler issue, as the
AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer
relies on the control flow graph to determine how variables are used.FYI @mavasani