You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upgraded SonarAnalyzer.CSharp from 9.19.0.84025 to 9.20.0.85982 and started hitting this error with multiple builds:
CSC : error AD0001: Analyzer 'SonarAnalyzer.Rules.CSharp.SymbolicExecutionRunner' threw an exception of type 'SonarAnalyzer.SymbolicExecution.SymbolicExecutionException' with message 'Error processing method: XXX
Method file: YYY
Method line: 120,4
Inner exception: System.NullReferenceException: Object reference not set to an instance of an object.
at SonarAnalyzer.SymbolicExecution.Roslyn.BinaryOperatorKindExtensions.NumberConstraintFromRelationalOperator(BinaryOperatorKind kind, NumberConstraint existingNumber, NumberConstraint comparedNumber)
at SonarAnalyzer.SymbolicExecution.Roslyn.OperationProcessors.IsPattern.LearnBranchingConstraint(ProgramState state, IPatternOperationWrapper pattern, Boolean falseBranch, Boolean hasObjectConstraint, NumberConstraint numberConstraint)
at SonarAnalyzer.SymbolicExecution.Roslyn.OperationProcessors.IsPattern.LearnBranchingConstraint(ProgramState state, IIsPatternOperationWrapper operation, Boolean falseBranch)
at SonarAnalyzer.SymbolicExecution.Roslyn.OperationProcessors.BranchingProcessor`1.Process(SymbolicContext context, T operation)
at SonarAnalyzer.SymbolicExecution.Roslyn.OperationProcessors.MultiProcessor`1.Process(SymbolicContext context)
at SonarAnalyzer.SymbolicExecution.Roslyn.OperationDispatcher.Process(SymbolicContext context)
at SonarAnalyzer.SymbolicExecution.Roslyn.RoslynSymbolicExecution.ProcessOperation(ExplodedNode node)+MoveNext()
at SonarAnalyzer.SymbolicExecution.Roslyn.RoslynSymbolicExecution.Execute()
at SonarAnalyzer.Rules.SymbolicExecutionRunnerBase.AnalyzeRoslyn(SonarAnalysisContext analysisContext, SonarSyntaxNodeReportingContext nodeContext, ISymbol symbol)'.
Repro steps
This error occurred in several areas of code, looks like typically happens with a switch: private static double GetNormalizedNumMonthsForPastDate(double numMonths) { var normalizedNumMonths = numMonths switch { < 0 => Constants.MinMonthsValue, >= Constants.MaxMonthsValue => Constants.MinMonthsValue, _ => 12 - numMonths }; normalizedNumMonths += 1; return normalizedNumMonths; }
Known workarounds
Related information
C# 12.0
Jetbrains Rider 2023.3.3
.net 8.0.2
MacOS
The text was updated successfully, but these errors were encountered:
Description
Upgraded SonarAnalyzer.CSharp from 9.19.0.84025 to 9.20.0.85982 and started hitting this error with multiple builds:
Repro steps
This error occurred in several areas of code, looks like typically happens with a switch:
private static double GetNormalizedNumMonthsForPastDate(double numMonths) { var normalizedNumMonths = numMonths switch { < 0 => Constants.MinMonthsValue, >= Constants.MaxMonthsValue => Constants.MinMonthsValue, _ => 12 - numMonths }; normalizedNumMonths += 1; return normalizedNumMonths; }
Known workarounds
Related information
The text was updated successfully, but these errors were encountered: