Roslyn Analyzers: Code Quality & Enforcement
Roslyn Analyzers are a .NET compiler platform feature that inspect source code during compilation and emit diagnostics — errors, warnings, or informational messages — without any runtime overhead. They run inside the compiler pipeline, which means violations are caught before the binary is produced, not after tests run or code ships.
The .NET SDK ships a large set of built-in analyzers covering null safety, performance anti-patterns, security pitfalls, and API usage correctness. Third-party packages extend that coverage significantly: StyleCop, Roslynator, and domain-specific analyzer packages cover areas the SDK rules leave open. The gap between “compiles cleanly” and “meets team standards” is where custom analyzers live.
Writing a custom analyzer means working with the Roslyn API: registering syntax node or symbol actions, walking the semantic model, and reporting diagnostics with precise location information. The incremental source generator infrastructure shares the same pipeline, and analyzers that also ship code fixes integrate directly into the IDE’s quick-action menu — team members see the problem and the correction in the same gesture.
Build enforcement is where analyzers pay off at scale. Marking an analyzer’s severity as error in an .editorconfig or Directory.Build.props file turns a stylistic preference into a hard gate that CI cannot bypass. Version-controlled severity configuration means the rules travel with the repository and apply consistently across machines, branches, and contributors — no per-developer IDE configuration required.
The articles in this collection cover the Roslyn diagnostic API, custom analyzer development, code fix providers, and the build integration patterns that make analyzer rules enforceable rather than advisory.

Standardize or Drift: One Defaults Package for All Your Solutions
Directory.Build.props drift is the quiet tax every multi-repo .NET org pays. NetEvolve.Defaults ships MSBuild properties, .editorconfig, NuGet Audit, and ten Roslyn diagnostics as a private-asset NuGet package. Bump the version once, every repo gets the upgrade.