Tips and more resourcesΒΆ
Diagnostic Analyzers in Visual Studio 2015: First Look by Kathleen Dollard.
Introduction to the .NET Compiler Platform by Bart De Smet.
If you have a question about how to do something with Roslyn try out the Gitter channel for Roslyn.
Explore the Roslyn Repo. Especially look into:
- How To Write a C# Analyzer and Code Fix.
- The Syntax Visualizer. This is an invaluable tool to help understand the syntax tree.
- Analyzers and Localization. I also recommend looking at how localization is done on the project created by the default Visual Studio template for analyzers to get an idea of how it works.
- .NET Compiler Platform (“Roslyn”) Overview.
Since the .NET Compiler Platform is vast I recommend searching github for roslyn analyzers to get ideas and learn how to use it.
Enable concurrent execution of your analyzers and prevent them from running in auto generated code by using the following in your diagnostic analyzer class:
public override void Initialize(AnalysisContext context) { context.EnableConcurrentExecution(); context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); ... }
There are more advanced Roslyn classes that can aid you in doing very cool things. Look for more Roslyn related info on:
- Data flow Analysis
- Control flow Analysis
- CSharp Syntax Rewriter
- Workspace Services
- Classifier Service
- Formatter Service
- Renamer Service
- Simplifier Service