Roslyn analyzers
With the advent of the Roslyn compiler, Microsoft has exposed a way for us to write our own custom rules (called analyzers) and have them executed by the compiler. We can now write rules that run as we type and show up in the IDE, just as with the built-in functionality such as undeclared variables, and we can even add code fixes for them!
To develop Roslyn rules in Visual Studio 2019 for Windows, we need the .NET Compiler Platform SDK functionality. This can be installed using the Visual Studio Installer by selecting it from the Individual components tab, under the Compilers, build tools, and runtimes category. You can easily get to the installer by selecting Tools | Get Tools and Features in Visual Studio. The following screenshot shows the .NET Compiler Platform SDK functionality:
Roslyn in Visual Studio 2019 for Windows
This functionality was broken in Visual Studio 2019 for Windows...