C# 'Calculations should not overflow' rule is changing

Hi .NET Folks

I’d like to update you on our plans for the rule ‘calculations should not overflow’. We think this is a valuable rule but are not satisfied with its current accuracy, and for this reason, it’s not part of the Sonarway profile. After the release of the upcoming SonarQube LTS, during the 10.x cycle, we plan to change the way it works by using features available in more recent versions of the Roslyn compiler. These changes will improve the precision of the rule, remove the Windows-only limitations and also bring the rule directly to your IDE via SonarLint or NuGet package.

The tradeoff for the increased accuracy is that this rule will require a build using MSBuild 15+. Once this is done builds using older MSBuild versions will not raise issues for this rule. Until then you can continue to use this rule as you do now.

1 Like