Getting a AD0001 Error from Visual Studio 2019 with Relation to SonarQube

warning AD0001: Analyzer ‘SonarAnalyzer.Rules.CSharp.CbdeHandlerRule’ threw an exception of type ‘SonarAnalyzer.CBDE.CbdeException’ with message ‘Top level error in CBDE handling: ImplicitObjectCreationExpression
## Details:
## Inner exception:
## Stack trace: at SonarAnalyzer.ControlFlowGraph.CSharp.CSharpControlFlowGraphBuilder.BuildExpression(ExpressionSyntax expression, Block currentBlock)
## at SonarAnalyzer.ControlFlowGraph.CSharp.CSharpControlFlowGraphBuilder.BuildVariableDeclaration(VariableDeclarationSyntax declaration, Block currentBlock)
## at SonarAnalyzer.ControlFlowGraph.CSharp.CSharpControlFlowGraphBuilder.BuildStatements(IEnumerable`1 statements, Block currentBlock)
## at SonarAnalyzer.ControlFlowGraph.CSharp.CSharpControlFlowGraphBuilder.Build(SyntaxNode node, Block currentBlock)
## at SonarAnalyzer.ControlFlowGraph.AbstractControlFlowGraphBuilder.Build()
## at SonarAnalyzer.CBDE.MlirExporter.ExportFunction(MethodDeclarationSyntax method)
## at SonarAnalyzer.CBDE.CbdeHandler.ExportFunctionMlir(SyntaxTree tree, SemanticModel model, MlirExporterMetrics exporterMetrics, String mlirFileName)
## at SonarAnalyzer.CBDE.CbdeHandler.b__31_0(CompilationAnalysisContext c)’.

Unknown on how to replicate. This is currently occurring on a single project, other projects have not reported it.

  • Enterprise Edition
  • Version 7.9.4 (build 35981)

P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour

Hi @JaedenRuiner, thanks for reporting this to us.

Are you using SonarLint? If so, what is your SonarLint version?
Or are you referencing the SonarAnalyzer as a nuget package? If so, what is the package’s version?

Sorry for the delay,
I am typically on the most recent version of SonarLint, Which at this point is 8.20 i believe.

However, i’m not getting this from SonarLint, I think.
We run a post build process from Visual Studio, that executes a scan for our SonarQube server, using the latest 5.10 scanner for .Net Framework.

That is where i believe the error is occurring.
Either way, it seems to be almost random when this error will or won’t occur as some projects work just fine but others do not.

I can confirm this is not a SonarLint issue at this point. I have removed the SonarAnalyzer.CSharp nuget package from the project, and i still get this error when running our post build scan using the “SonarScanner.MSBuild.exe” standalone scanner for SonarQube.

I have also honed in on the nature of the cause: Implicit Object Creation.
I haven’t worked out exactly when the scanner allows for Implicit Object Creation, but thus far doing anything other than

MyType x = new(); //When MyType is defined in the current assembly

Any other usage of the Implict Object Creator, causes this error to arise. If there are parameters in the constructor, or if implicit creation is part of a “using” expression, or if the implicit constructor is followed by an object initialization block.
When i carte blanche replace all instances of IDE0090 info-hint in my code, i run a chance of incurring this flaw in the scanner.

Hello @JaedenRuiner

To get the latest SonarCSharp version, you would need to update to the latest SonarQube version 8.8. In SonarCSharp 8.16 we’ve fixed #3814, and in 8.18 we’ve removed S3949 from SonarWay due to its performance problems and currently limited functionality.

We even have a unit test case with target-typed new to make sure it doesn’t throw.

To avoid having noise in your logs, you can either update your SQ instance to benefit of the latest analyzers, or remove S3949 from your Quality Profile.

The last version of SonarLint is 4.33.

I hope this helps.


To clarify - SonarAnalyzer.Rules.CSharp.CbdeHandlerRule is the RSPEC-3949 Calculations should not overflow rule.