Open 333fred opened 1 month ago
Diagnostic ID: RS1039: GetDeclaredSymbol will always return null
GetDeclaredSymbol will always return null
Version: Microsoft.CodeAnalysis.Analyzers 3.11.0
There are a number of false positives in the analyzer. Some false positives it flags in roslyn:
https://github.com/dotnet/roslyn/blob/62af60c7637252896646f0e0df015d42bb584b7f/src/Compilers/CSharp/Test/Symbol/Compilation/SemanticModelAPITests.cs#L1886 - error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(StatementSyntax)' will always return 'null' https://github.com/dotnet/roslyn/blob/62af60c7637252896646f0e0df015d42bb584b7f/src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs#L8313 - error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(ModifiedIdentifierSyntax)' will always return 'null' https://github.com/dotnet/roslyn/blob/62af60c7637252896646f0e0df015d42bb584b7f/src/Compilers/CSharp/Test/Symbol/Symbols/Source/DeclaringSyntaxNodeTests.cs#L141 - error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(TNode)' will always return 'null' https://github.com/dotnet/roslyn/blob/62af60c7637252896646f0e0df015d42bb584b7f/src/Compilers/CSharp/Test/Emit3/Semantics/PatternMatchingTests_ListPatterns.cs#L4259 - error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(VariableDesignationSyntax)' will always return 'null'
error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(StatementSyntax)' will always return 'null'
error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(ModifiedIdentifierSyntax)' will always return 'null'
error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(TNode)' will always return 'null'
error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(VariableDesignationSyntax)' will always return 'null'
These are only a few of the false positives. A full list can be obtained by building dotnet/roslyn and turning RS1039 back on; I've turned it off for now due to the noise.
dotnet/roslyn
Analyzer
Diagnostic ID: RS1039:
GetDeclaredSymbol will always return null
Analyzer source
Version: Microsoft.CodeAnalysis.Analyzers 3.11.0
Describe the bug
There are a number of false positives in the analyzer. Some false positives it flags in roslyn:
https://github.com/dotnet/roslyn/blob/62af60c7637252896646f0e0df015d42bb584b7f/src/Compilers/CSharp/Test/Symbol/Compilation/SemanticModelAPITests.cs#L1886 -
error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(StatementSyntax)' will always return 'null'
https://github.com/dotnet/roslyn/blob/62af60c7637252896646f0e0df015d42bb584b7f/src/Compilers/CSharp/Test/Symbol/SymbolDisplay/SymbolDisplayTests.cs#L8313 -error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(ModifiedIdentifierSyntax)' will always return 'null'
https://github.com/dotnet/roslyn/blob/62af60c7637252896646f0e0df015d42bb584b7f/src/Compilers/CSharp/Test/Symbol/Symbols/Source/DeclaringSyntaxNodeTests.cs#L141 -error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(TNode)' will always return 'null'
https://github.com/dotnet/roslyn/blob/62af60c7637252896646f0e0df015d42bb584b7f/src/Compilers/CSharp/Test/Emit3/Semantics/PatternMatchingTests_ListPatterns.cs#L4259 -error RS1039: A call to 'SemanticModel.GetDeclaredSymbol(VariableDesignationSyntax)' will always return 'null'
These are only a few of the false positives. A full list can be obtained by building
dotnet/roslyn
and turning RS1039 back on; I've turned it off for now due to the noise.