Static analysis for .NET 5 · Issue #30740 · dotnet/runtime (original) (raw)

In FxCop's hey day, many rules were written to help validate the correctness and performance of .NET code. .NET has evolved significantly since then, however, and the creation of new rules has not kept up with the times; we've added very few new analyzers to help validate the correctness and performance of code using the wealth of new types, methods, and patterns that have made their way into .NET in the interim.

For .NET 5, we should augment https://github.com/dotnet/roslyn-analyzers/tree/master/src/Microsoft.NetCore.Analyzers with new analyzers to help further validate the correctness and improve the performance of code written for .NET.

Guidelines:

This issue exists to collect and catalog ideas for such rules to be implemented in the .NET 5 timeframe.

Note that the notes below are just starting ideas... cases called out may not be the right ones to check, may be missing additional cases of importance, etc. When we decide to tackle one of these, part of the work item (which should be split off into a separate issue) will be determining the right heuristics to employ (and potentially even deciding that the false positive rate will be too high to include such a rule at all).

code-analyzer Marks an issue that suggests a Roslyn analyzer

Edit: this work is actively happening and you can track progress here: https://github.com/dotnet/runtime/projects/46

Old List### Correctness

System

System.Buffers

System.Linq

System.Runtime.InteropServices

System.Runtime.Intrinsics

System.Text.Json

System.Threading

System.Threading.Tasks

Performance

System

Span
String
StringBuilder
Stream
Tuples
Nullable
Other

System.Collections

System.Collections.Concurrent

System.Runtime.InteropServices

System.Threading

System.Threading.Tasks

Style

System.Runtime.InteropServices

System.Threading

cc: @jaredpar, @mavasani, @danmosemsft