Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create analyzer to correctly guide users using GetDeclaredSymbol() and GetSymbolInfo() #337

Open
JoshVarty opened this issue Nov 5, 2015 · 1 comment
Labels
Area-Microsoft.CodeAnalysis.Analyzers Feature Request help wanted The issue is up-for-grabs, and can be claimed by commenting
Milestone

Comments

@JoshVarty
Copy link
Contributor

The difference between these two APIs is not always clear to people new to Roslyn. See this Stack Overflow question as an example.

I'm not 100% on the rule, but could we make an analyzer that says:

  • If you are passing a SyntaxNode with DeclarationSyntax in the name to GetSymbolInfo(), issue a warning.
  • If you are passing a SyntaxNode without DeclarationSyntax in the name to GetDeclaredSymbol, issue a warning.

I'm not 100% sure if this rule correctly covers all cases, but it might be a good starting point. I'd love to get some feedback on whether or not this approach would make sense.

@mavasani
Copy link
Contributor

mavasani commented Nov 6, 2015

👍
@JoshVarty This seems like a very good rule, I have personally gone wrong here many times.

@srivatsn srivatsn added this to the Unknown milestone Dec 30, 2015
@sharwell sharwell added help wanted The issue is up-for-grabs, and can be claimed by commenting and removed Up for Grabs labels Aug 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Microsoft.CodeAnalysis.Analyzers Feature Request help wanted The issue is up-for-grabs, and can be claimed by commenting
Projects
None yet
Development

No branches or pull requests

4 participants