Releases: SonarSource/sonar-dotnet
9.27
This release includes a ton of false positive and false negative fixes. We would also like to thank @sagi1623 for his contribution in #8464, which fixed three issues 🚀.
Improvements
- RSPEC change - Rule S1694: Promoted to SonarWay
- 9390 - Rule S6608: Benchmark is benchmarking the wrong things
- 8795 - [C#] Improve S1694: Remove part about protected constructor
- 5417 - Enable multiple project level issues
- 9372 - Update RSPEC before 9.27 release
False Positive
- 9247 - [C#] Fix S2629 FP: Constant fields in interpolated string
- 9241 - [C#, VB.NET] Fix S2094 FP: Allow empty queries
- 9106 - [C#] Fix S3459 FP: Backing field with
ref
property - 8522 - [C#, VB.NET] Fix S3220 FP: Rule does not take into account generics
- 8436 - [C#] Fix S3253 FP: Don't raise for primary constructor in type declarations without parameters when they inherit from types with parameters
- 8199 - [C#, VB.NET] Fix S2737 FP: Raised when exception filter is used
- 8025 - [C#] Fix S2325 FP: Partial method implementations
- 7521 - [C#] Fix S2743 FP: Should not raise when base type is generic
- 7137 - [VB.NET] Fix S1654 FP: Do not report on event handlers, interfaces and overrides
False Negative
- 9002 - [C#, VB.NET] Fix S6931 FN: Route templates starting with
~/
- 6644 - [C#] Fix S2190 FN: No issues raised if recursion is inside an EventDeclaration by @sagi1623
- 6643 - [C#] Fix S2190 FN: No issues raised if recursion is inside a ConversionOperatorDeclaration by @sagi1623
- 6642 - [C#] Fix S2190 FN: No issues raised if recursion is inside an indexer by @sagi1623
- 4081 - [C#] Fix S2743 FN: Static fields of nested class inside generic class
9.26
New Rules
- 8871 - [C#] New rule S6932: Use model binding instead of reading raw request data
- 8992 - [C#] New rule S4347: Secure random number generators must not output predictable values
- 8996 - [C#] New rule S6781: JWT secret keys should not be disclosed
- 8982 - [C#] New rule S6377: XML signatures should be verified securely
- 8998 - [C#] New rule S5344: Passwords should not be stored in plain-text or with a fast hashing algorithm
Bug Fixes
- 8577 - Fix S2234 Bug: AD0001 is thrown due to referencing a location outside of the current compilation
Improvements
False Positive
- 9360 - [C#] Fix S6964 FP: Properties decorated with the [BindNever] attribute
- 9337 - [C#] Fix S6964 FP: Add more attributes to the exclusions
- 9336 - [C#] Fix S6966 FP: Don't raise on XmlReader and XmlWriter methods
- 9331 - [C#] Fix S6964 FP: Property with a default value
- 9285 - [C#] Fix S6964 FP: Do not raise in properties with required modifier
- 9284 - [C#] Fix S6964 FP: Should not raise for reference properties in nullable context
- 9275 - [C#] Fix S6964 FP: Don't raise on properties annotated with the JsonRequiredAttribute
- 9269 - [C#] Fix S6966 FP: EntityFrameworks DbContext/DBSet Add/AddRange methods are preferred over their Async counterpart
- 9265 - [C#] Fix S6966 FP: MongoDB Find can not be replaced by FindAsync
- 9252 - [C#] Fix S6934 FP: Abstract Controller base class
- 8985 - [C#] Fix S6934 FP: Attributes implementing
IRouteTemplateProvider
or inheriting from RouteAttribute
False Negative
9.25.1
The latest Roslyn compiler version changes the way Razor files are compiled, and this hotfix release takes care of these changes. For more information check this issue.
Bug Fixes
- 9288 - [C#] Metrics analyzer for Razor: Lines of code are outside the range of the file
9.25
Hello everyone,
This release comes with seven new rules for ASP.NET core alongside some improvements.
Enjoy!
New Rules
- 9096 - [C#] New Rule S6966: Awaitable method should be used
- 9095 - [C#] New Rule S6967: ModelState.IsValid should be called in controller actions
- 9094 - [C#] New Rule S6964: The value type properties of a model class should be nullable or marked as "Required" to avoid under-posting.
- 9093 - [C#] New rule S6968: Actions that return a value should be annotated with ProducesResponseTypeAttribute containing the return type
- 9092 - [C#] New rule S6965: You should use HttpAttribute in API controller actions
- 9091 - [C#] New rule S6962: You should pool HTTP connections with HttpClientFactory
- 9089 - [C#] New rule S6960: Controllers should not have too many responsibilities
Bug Fixes
False Positive
Improvements
Rule deprecations and deletions
9.24
Hey everyone,
This release contains one new ASP.NET Rule (S6961) and several general improvements and fixes. Enjoy!
Improvements
- 9090 - [C#] New rule S6961 for C#: API Controllers should derive from ControllerBase instead of Controller
- 8696 - Fix coverage aggregation from multiple reports
- 9048 - Create SonarAnalyzer.CSharp.Styling project
- 7774 - [C#, VB.NET] Fix S1144: Nested type constructor accessibility is wrong in the rule message
- 8980 - Update RSPEC before 9.24 release
Bug Fixes
- 9113 - [C#, VB.NET] AD0001: ArgumentNullException in SymbolicExecutionRunner
- 8977 - [C#] CfgAllPathValidator AreAllSuccessorsValid Stack Overflow on Windows and error MSB6006 in Linux Codespaces
False Positive
- 9063 - [C#, VB.NET] Fix S2094 FP: Should not raise for messages
- 9062 - [C#, VB.NET] Fix S2094 FP: Documentation using the DefaultDocumentation package
- 7591 - [C#, VB.NET] Fix S2094 FP: Implicit parameterless constructor widens the scope of the base class constructor
- 8163 - [C#, VB.NET] Fix S3878 FP: Jagged arrays
False Negative
9.23.2
Hello, everyone!
Today we are doing a bug fix release that also addresses a couple of false positives. We deprecated VB support for S6931 and removed the rule from the "Sonar Way" quality profile for VB.
Special thanks to @Corniel for fixing #9019!
Bug fix
Improvements
- 9075 - Update RSPEC before 9.23.2 release
False Positive
9.23.1
9.23
Hello everyone!
This release comes with two new rules for ASP.NET, false positive fixes, and other improvements.
A big thank you to @Corniel for their external contribution with #8898!
New Rules
- 8872 - [C#] New rule S6934: You should specify the RouteAttribute when an HttpMethodAttribute is specified at an action level
- 8870 - [C#, VB.NET] New rule S6931: ASP.NET controller actions should not have a route template starting with "/"
False Positives
- 8898 - [C#] Fix S3993 FP: Allow abstract attributes not to decorate Attribute usage
- 8510 - [C#] Fix S3878 FP: When the input array is a collection expression with the spread operator
- 8260 - [C#] Fix S1117 FP: Field/property instances are not accessible from static methods
- 7709 - [C#] Fix S2094 FP: Marker interface not detected when using records
- 6633 - [C#] Fix S2857 FP: Rule is not checking SQL keywords in const interpolated string
Other improvements and fixes
9.22
New Rules
- 8869 - [C#, VB.NET] New rule S6930: Backslash should be avoided in route templates
- 8844 - [C#] New rule S3416: Loggers should be named for their enclosing types
- 8840 - [C#] New rule S6675: Trace.WriteLineIf should not be used with TraceSwitch levels
- 8847 - [C#] New rule S2139: Exceptions should be either logged or rethrown but not both
- 8845 - [C#] New rule S6664: Too many logging calls within a code block
- 8843 - [C#] New rule S6672: Generic logger injection should match enclosing type
- 8842 - [C#] New rule S6669: Logger field names should comply with a naming convention
- 8841 - [C#] New rule S6670: Trace.Write and Trace.WriteLine should not be used
- 8769 - [C#] New rule S6673: Log message template placeholders should be in the right order
- 8846 - [C#] New rule S1312: Logger fields should be
private static readonly
[Non-SonarWay]
False Positive
9.21
New Rules
- 8771 - [C#] New rule S6678: Use PascalCase for named placeholders
- 8770 - [C#] New rule S6674: Log message template should be syntactically correct
- 8768 - [C#] New rule S2629: Logging templates should be constant
- 8767 - [C#] New rule S6677: Named placeholders should be unique
- 8766 - [C#] New rule S6667: Exceptions should be passed as an argument when logging in a catch clause
- 8765 - [C#] New rule S6668: Logging arguments should be passed to the correct parameter
Improvements
- The following rules were promoted to the SonarWay profile: S127, S1244, S1696, S1192, S1994, S2701, S2955
Bug Fixes
- 8787 - [C#] Fix AD0001: SonarAnalyzer.Rules.CSharp.SymbolicExecutionRunner throws an exception on unknown Numeric Constraints