Skip to content

This repository contains the source code for my talk about Roslyn Analyzers!

Notifications You must be signed in to change notification settings

shahab-the-guy/code-joy-ride

Repository files navigation

Roslyn Analyzers - Code JoyRide

An example projects that includes Roslyn analyzers with code fix providers. Enjoy this template to learn from and modify analyzers for your own needs.

Agenda

We will try to cover at least two of the following bullet points:

  • Quick Introduction to Compilers and Roslyn
  • Developing a Semantic Code Analyzer
  • Providing a Code Fix Provider for the Analyzer

The workshop would be interactive and we do live coding.

Prerequisites

Content

CodeJoyRide.Fx.Analyzer

A .NET Standard project with implementations of sample analyzers and code fix providers. You must build this project to see the results (warnings) in the IDE.

CodeJoyRide.Api

A project that references the CodeJoyRide.Fx analyzers. Note the parameters of ProjectReference in CodeJoyRide.Api.csproj, they make sure that the project is referenced as a set of analyzers.

CodeJoyRide.Fx.Analyzer.Tests

Unit tests for the CodeJoyRide analyzers and code fix provider. The easiest way to develop language-related features is to start with unit tests.

How To?

How to debug?

How can I determine which syntax nodes I should expect?

  • Consider using https://sharplab.io/ and set the Result to Szntax Tree
  • On Visual Studio Code, consider installing the extension CSharp Syntax Visualizer
  • Consider installing the Roslyn syntax tree viewer plugin Rossynt.
    • Unfortunately, based on my experience this one is not working on Rider's latest versions.

Learn more about wiring analyzers

The complete set of information is available at roslyn github repo wiki.

About

This repository contains the source code for my talk about Roslyn Analyzers!

Resources

Stars

Watchers

Forks

Packages

No packages published