VS 2022. SonarLint C#. AD0001 Analyzer 'SonarAnalyzer.Rules.CSharp.StreamReadStatement' threw an exc

I am using SonarLint extension in VS 2022 on Windows 10 box.
SonarLint version is 6.6.0.49766

During analysis I am getting a lot of following warnings:
Warning AD0001 Analyzer 'SonarAnalyzer.Rules.CSharp.StreamReadStatement' threw an exception of type 'System.MissingMethodException' with message 'Method not found: 'Void SonarAnalyzer.Helpers.AnalysisContextExtensions.ReportDiagnosticWhenActive(Microsoft.CodeAnalysis.Diagnostics.SyntaxNodeAnalysisContext, Microsoft.CodeAnalysis.Diagnostic)'.'.
Exception occurred with following context:
Compilation: Project
SyntaxTree: <FileName>.cs
SyntaxNode: _ = services.AddSingleton<ICfrInfosValidator … [ExpressionStatementSyntax]@[909…976) (21,12)-(21,79)

System.MissingMethodException: Method not found: 'Void SonarAnalyzer.Helpers.AnalysisContextExtensions.ReportDiagnosticWhenActive(Microsoft.CodeAnalysis.Diagnostics.SyntaxNodeAnalysisContext, Microsoft.CodeAnalysis.Diagnostic)'.
   at SonarAnalyzer.Rules.CSharp.StreamReadStatement.<>c.<Initialize>b__6_0(SyntaxNodeAnalysisContext c)
   at SonarAnalyzer.Helpers.DiagnosticAnalyzerContextHelper.<>c__DisplayClass1_0`1.<RegisterSyntaxNodeActionInNonGenerated>b__0(SyntaxNodeAnalysisContext c)
   at SonarAnalyzer.Helpers.SonarAnalysisContext.<>c__DisplayClass47_0`1.<RegisterContextAction>b__0(TContext c)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__62`1.<ExecuteSyntaxNodeAction>b__62_0(ValueTuple`2 data)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info)

Any hints how to remedy the situation would be greatly appreciated

Hi,

Can you confirm that you’re on the latest version of SonarLint for Visual Studio?

 
Ann

SonarLint version is 6.6.0.49766

Hello @fatherOfWine

I looked into this and it seems that incompatible versions of some of our DDLs are causing the issue. Can you try to uninstall and reinstall SonarLint? If this does not solve the problem you should check if you also have a direct reference to our analyzer packages in your solution:

If so, can you please upgrade the Nuget package to the newest version?

Best regards, Martin

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.