After earlier this week, builds were working again, but now we kind of run into the same error I think.
Project that have “SonarAnalyzer.CSharp” installed will fail with the error:
CSC(0,0): Error AD0001: Analyzer ‘SonarAnalyzer.Rules.CSharp.UcfgGenerator’ threw an exception of type ‘SonarAnalyzer.ControlFlowGraph.UcfgException’ with message ‘Exception during creation of UCFG: Method name: ExtractSelectedFacetten Syntax node kind: MethodDeclaration File: D:\a\1\s\Website\PinHigh.MappingLayer\Services\ProductService.cs Line: 55,8 ## SonarAnalyzer.ControlFlowGraph.UcfgException: Unexpected state, method called as extension of a member but there is no member access available. ## at SonarAnalyzer.ControlFlowGraph.CSharp.UcfgInstructionFactory.ProcessInvocationExpression(InvocationExpressionSyntax invocationSyntax) ## at System.Linq.Enumerable.d__172.MoveNext() ## at Google.Protobuf.Collections.RepeatedField1.AddRange(IEnumerable1 values) ## at SonarAnalyzer.ControlFlowGraph.CSharp.UcfgBlockFactory.CreateBasicBlock(Block block) ## at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() ## at Google.Protobuf.Collections.RepeatedField1.AddRange(IEnumerable1 values) ## at SonarAnalyzer.ControlFlowGraph.CSharp.UcfgFactory.Create(SyntaxNode syntaxNode, IMethodSymbol methodSymbol, IControlFlowGraph cfg)’.
Projects that don’t have this package installed will succeed but will still get lots of wanrings like this one:
warning AD0001: Analyzer ‘SonarAnalyzer.Rules.CSharp.UcfgGenerator’ threw an exception of type ‘SonarAnalyzer.ControlFlowGraph.UcfgException’ with message 'Exception during creation of UCFG: Method name: Update Syntax node kind: MethodDeclaration File:
Thank you for reporting this issue. Would you mind sharing with us the line 55 of ProductService.cs? This exception is thrown in a case that is not expected to happen (i.e. we detect an extension method but it isn’t used as extension nor as static call).
Line 55 is en empty line, in total we get 3 of those messages for this project and all on empty lines, in this case the empty line is preceded by the this method:
public List<GolfbaanViewModel> GetLinkedGolfbanenFromProduct(int productid)
{
return _mapper.Map<List<GolfbaanViewModel>>(_productRepository.GetLinkedGolfbanenFromProduct(productid));
}
Thanks for all your answers. Can you just confirm you have these warnings but no errors (i.e. even if you see these warnings the analysis is still complete and results are pushed to SonarCloud).