sonar-dotnet icon indicating copy to clipboard operation
sonar-dotnet copied to clipboard

Code analyzer for C# and VB.NET projects

Results 507 sonar-dotnet issues
Sort by recently updated
recently updated
newest added

### Description When using null conditional like in the below example, S2259 gives a FP. It may be the fact that `string.Equals` does not apply the correct constraints on the...

Area: CFG/SE
Area: C#
Type: CFG/SE FPs

### Repro steps ```cs public class TokenService { private AccessTokenModel _lastTokenModel; public DateTime? LastIssue { get; private set; } public string GetAccessToken() { if (LastIssue + _lastTokenModel?.ExpiresIn > DateTime.Now) return...

Area: CFG/SE
Area: C#
Type: CFG/SE FPs

### Description S2259 is incorrectly reported when using null conditional with null coalescing operator. ### Repro steps ```cs private void Sample() { string someString = null; if (!someString?.Contains("a") ?? true)...

Area: CFG/SE
Area: C#
Type: CFG/SE FPs

### Description S2259 raises an issue telling that the return value of the ToList() is is null on at least one execution path. ### Repro steps ``` public static long...

Area: C#
Type: CFG/SE FPs

### Description Combining a null-coalescing operator with the “continue” keyword in a for loop still reports the variable usage with is null on at least one execution path. ### Repro...

Area: C#
Type: CFG/SE FPs

An issue on peach: https://peach.sonarsource.com/issues?open=AXoJkYeoXaALAbC4wYt6&rules=csharpsquid%3AS2259&statuses=CLOSED Has history like this: ``` November 21, 2021, 1:12 AM Resolution removed (was FIXED)Status changed to OPEN (was CLOSED) November 21, 2021, 1:49 AM Resolution...

Type: Improvement
Area: CFG/SE
Area: C#

### Description The following example produces a false positive of rule S2259 on the `Length` property access, claiming that the array `a` could be `null`in some cases. ### Repro steps...

Area: CFG/SE
Area: C#
Type: CFG/SE FPs

Symbolic Execution: SwitchArms of C# 8 switch statements does not build constraints for their symbolic value. Basic constraints for simple cases (true / false literals, non-null constraints) should be added....

Type: Improvement
Area: CFG/SE
Area: C#8

For purpose of development, the Sonar SE engine is used as default. We need to switch it to Roslyn. Or maybe consider using both engines together in case we don't...

Type: Improvement
Area: CFG/SE
Area: C#

Implement S2259 for VB.NET. This rule will be available only for MsBuild 16+ and VS2019+

Type: New Feature
Area: CFG/SE
Area: VB.NET