The following warning is generated for a particular class
Severity Code Description Project File Line Suppression State Detail Description
Warning AD0001 Analyzer 'SonarAnalyzer.Rules.CSharp.ImplementIDisposableCorrectly' threw an exception of type 'System.ArgumentException' with message 'Syntax node is not within syntax tree'. TestTraceListener 1 Active Analyzer 'SonarAnalyzer.Rules.CSharp.ImplementIDisposableCorrectly' threw the following exception:
'Exception occurred with following context:
Compilation: HBAS.Automation.TestTraceListener
SyntaxTree: C:\Users\jcurl\Documents\Programming\helios.base\framework\testtracelistener\code\TestCase.MappingCollection.cs
SyntaxNode: public partial class TestCase { ... [ClassDeclarationSyntax]@[142..6895) (7,4)-(147,5)
System.ArgumentException: Syntax node is not within syntax tree
at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.CheckSyntaxNode(CSharpSyntaxNode syntax)
at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDeclaredMemberSymbol(CSharpSyntaxNode declarationSyntax)
at Microsoft.CodeAnalysis.CSharp.SyntaxTreeSemanticModel.GetDeclaredSymbol(BaseMethodDeclarationSyntax declarationSyntax, CancellationToken cancellationToken)
at SonarAnalyzer.Rules.CSharp.ImplementIDisposableCorrectly.DisposableChecker.VerifyDispose(MethodDeclarationSyntax disposeMethod, Boolean isSealedClass)
at SonarAnalyzer.Rules.CSharp.ImplementIDisposableCorrectly.DisposableChecker.GetIssueLocations()
at SonarAnalyzer.Rules.CSharp.ImplementIDisposableCorrectly.<>c.<Initialize>b__6_0(SyntaxNodeAnalysisContext c)
at SonarAnalyzer.Helpers.DiagnosticAnalyzerContextHelper.<>c__DisplayClass0_0`1.<RegisterSyntaxNodeActionInNonGenerated>b__0(SyntaxNodeAnalysisContext c)
at SonarAnalyzer.Helpers.SonarAnalysisContext.<>c__DisplayClass12_0`1.<RegisterSyntaxNodeAction>b__0(SyntaxNodeAnalysisContext c)
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__DisplayClass42_1`1.<ExecuteSyntaxNodeAction>b__1()
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock(DiagnosticAnalyzer analyzer, Action analyze, Nullable`1 info)
-----
'.
Repro steps
Please see attached a copy of the two source files that appear to be relevant.
TestCaseMapping.zip
Expected behavior
No AD0001 should be raised.
Actual behavior
See problem description. AD0001 is unexpectedly raised
Description
The following warning is generated for a particular class
Repro steps
Please see attached a copy of the two source files that appear to be relevant. TestCaseMapping.zip
Expected behavior
No AD0001 should be raised.
Actual behavior
See problem description. AD0001 is unexpectedly raised
Known workarounds
None known
Related information