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

The implementations and signatures of "GetIdentfier" between VB and CSharp were not equivalent. VB returns "SyntaxToken", while CS returned "SimpleNameSyntax". The VB version is better because an identifier can be...

If an issue is expected (Noncompliant) but not raised, the test fails, but the stack trace with the link to the location is missing. **Note** `IssueLocationCollector.GetExpectedIssueLocations` throws `InvalidOperationException`s which should...

### History Issue with documentation tags was originally reported and fixed in #2694 with a simple reproducer: ```C# using System; // Compliant, used by cref. namespace SonarAnalyzer.Experiments.CSharp { public enum...

False Positive

### Description S2259 is raised even if tested before with custom assertion method. This issue therefore is similar to https://github.com/SonarSource/sonar-dotnet/issues/349 with the difference that I am referring to a custom...

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

### Description As reported on [this community thread](https://community.sonarsource.com/t/c-missing-simple-possible-null-references/22784) Linq `FirstOrDefault()` extension methods does not trigger S2259 "'item' is null on at least one execution path." All OrDefault Linq extensions should...

Type: False Negative
Area: CFG/SE
Area: C#

[RSPEC-2259](https://jira.sonarsource.com/browse/RSPEC-2259) - [ ] Reintroduce learning from Debug.Assert - [ ] Revert #397 - [ ] Introduce means to not raise "Expression always true/false" on values that were checked with...

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

### Description The following code snippet seems to trigger a false positive S2259 `'lastEx' is null on at least one execution path.` on the last line with the throw statement:...

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

When an IF statement uses the null conditional rule and (or?) the null coalescing operator then the else path is not marked as cannot be null, resulting in false S2259...

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

### Description C#8 introduces the concept of non-nullable reference types. By default, the reference types are considered non-nullable. See details in [Nullable reference types](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-8#nullable-reference-types). I analyzed andrei-epure-sonarsource/CSharp8Demo [on SonarCloud](https://sonarcloud.io/dashboard?id=Cs8Demo). Note...

Type: False Negative
Area: CFG/SE
Area: C#