Create analyzer to detect calls to SemanticModel.GetDeclaredSymbol() with fields and other invalid syntax #336
Labels
Area-Microsoft.CodeAnalysis.Analyzers
Feature Request
help wanted
The issue is up-for-grabs, and can be claimed by commenting
Milestone
Using
SemanticModel.GetDeclaredSymbol()
will always return null for certain pieces of syntax. According to the comments this is the case forGlobalStatementSyntax
,IncompleteMemberSyntax
, andBaseFieldDeclarationSyntax
.In order to guide new people using the API, we should provide an analyzer that checks for invalid calls to
GetDeclaredSymbol()
and issues a warning. (In particular the field syntax can be confusing for people who don't realize fields consist of multiple variables).The text was updated successfully, but these errors were encountered: