Skip to content
46

Awesome Roslyn

Curated list of awesome Roslyn books, tutorials, open-source projects, analyzers, code fixes, refactorings, and source generators

735 stars62 forks56 entriesLast push Jan 16, 2024 (2 years ago)License none

This page lists names, links and short descriptions. The original list on GitHub is the source and belongs to its authors.

Books

Roslyn Succinctly

Free e-book by Alessandro Del Sole and the perfect book to start with. Explains Roslyn APIs and afterward focuses on writing analyzers and refactorings.

.NET Development Using the Compiler API

Book by Jason Bock. Besides analyzers and refactorings, it also explains the scripting API and provides an interesting reflection on the future of the Compiler API.

Roslyn Cookbook

Book by Manish Vasani, a member of the Roslyn analyzers team. After covering analyzers, refactorings, and scripting in detail, the book goes in-depth explaining how to develop new C# language features and contribute to the Roslyn source code.

Tutorials

Learn Roslyn Now

Series of blog posts that explore the Roslyn compiler API. It introduces the power of Roslyn through small self-contained examples. A perfect tutorial to start with :-)

How To Write a C# Analyzer and Code Fix

The mother of all Roslyn tutorials :-) A realistic step-by-step introduction to syntax and semantic analysis as well as the syntax transformation.

In 5 listsDetails

C# and Visual Basic - Use Roslyn to Write a Live Code Analyzer for Your API

Older but still not outdated, very detailed MSDN article on writing code analyzers.

C# - Adding a Code Fix to Your Roslyn Analyzer

The sequel to the previous MSDN article. A detailed introduction into code fixes.

Introducing C# Source Generators

Original announcement of the C# 9.0 Source Generators feature. Explains what source generators are, in which scenarios they are useful, and shows how to write a simple source generator.

In 2 lists

New C# Source Generator Samples

Samples on how to write a non-trivial code generator driven by additional, non-code files like CSV files or Mustache templates.

In 2 lists

C# Source Generators

Comprehensive list of additional learning sources, samples, and experimental and productive source generators. A perfect reference once you grasp the basics.

In 2 listsDetails

Open Source Projects

Bridge

C# to JavaScript transpiler. Write modern mobile and web apps in C# and run them anywhere in JavaScript.

Code Converter

C# to VB.NET and VB.NET to C# transpiler.

CodeAnalysis.CSharp.PatternMatching

Intuitive pattern matching for Roslyn syntax trees. Simplifies C# syntax and semantic analysis.

CodeGeneration.Roslyn

Roslyn-based Code Generation during a build with design-time support.

dotnet-script

Runs C# scripts from the .NET CLI, defines NuGet packages inline and edit/debugs them in VS Code.

In 3 lists

FlubuCore

Cross platform build automation tool for building projects and executing deployment scripts using C# code.

In 3 lists

MirrorSharp

Online C#, VB.NET, and F# code editor. Features code completion, method signature help, quick fixes, and diagnostics.

OmniSharp

Enables a cross platform .NET development in the editor of your choice. A family of open source projects, each with one goal: To enable a great .NET experience in your editor of choice.

In 3 lists

roslyn-linq-rewrite

Compiles C# code by first rewriting the syntax trees of LINQ expressions using plain procedural code. This increases performance by minimizes heap allocations and dynamic dispatch.

RoslynPad

Cross-platform C# editor. Features code completion, method signature help, quick fixes, and diagnostics.

RoslynQuoter

Online tool that for a given C# program generates syntax tree API calls that construct syntax tree of that program.

scriptcs

Turns C# into a powerful scripting tool. Features C# REPL, installation of NuGet packages, and execution of scripts with a single line of code.

Scripty

Tool to use Roslyn-powered C# scripts for code generation. You can think of it as a scripted alternative to T4 templates.

Sharpen

Visual Studio extension that intelligently introduces new C# language features into your existing code base.

SharpLab

.NET code playground. Displays intermediate steps and results of code compilation. Shows the code as compiler sees it. Allows selecting different branches and versions of Roslyn. Runs C#, VB.NET, and F# code in the browser.

In 3 lists

Testura.Code

Wrapper around the Roslyn API used for generation, saving, and compiling C# code. Provides methods and helpers to generate classes, methods, statements, and expressions.

Uno SourceGenerator

C# source code generator based on a project being built, using all of its syntactic and semantic model information.

Open Source Analyzers, Code Fixes, and Refactorings

.NET Analyzers

GitHub organization for the development of Roslyn analyzers. Various repositories within the organization cover analyzers for ASP.NET Core, WPF, IDisposable, usages of System.Reflection, etc.

In 2 lists

.NET Compiler Platform ("Roslyn") Analyzers

Diagnostic analyzers developed by the Roslyn team. Initially developed to help flesh out the design and implementation of the static analysis APIs. The analyzers cover code quality, .NET Core, desktop .NET Framework, comments in code, and more.

In 4 listsDetails

Code Cracker

Analyzer library for C# and VB.NET. Offers diagnostics in many categories like performance, coding styles, as well as some basic refactorings.

CSharpGuidelinesAnalyzer

Reports diagnostics for C# coding guidelines (https://csharpcodingguidelines.com/).

ErrorProne.NET

Set of analyzers and code fixes focusing on the correctness and performance of C# programs. Inspired with Google's Error Prone.

Mapping Generator

Code fix that generates arbitrary complex object-object mappings. It recognizes out of the box a large number of scenarios where mappings are used. A design-time alternative to AutoMapper.

Nullable.Extended

Roslyn tools and analyzers to improve the experience when coding with nullable reference types.

Refactoring Essentials for Visual Studio

Refactorings, analyzers and code fixes for C# and VB.NET.

In 3 lists

Roslyn Clr Heap Allocation Analyzer

C# heap allocation analyzer that can detect explicit and many implicit allocations like boxing, closures, implicit delegate creations, etc.

Roslynator

Collection of 190+ analyzers and 190+ refactorings for C#. Covers coding style, code readability and simplification, removing redundancies, fixing compiler errors, and many more.

In 2 lists

SonarC#

Static code analyzer for C# language used as an extension for the SonarQube platform.

StyleCop Analyzers for the .NET Compiler Platform

Port of StyleCop rules to Roslyn.

In 3 lists

VSDiagnostics

Collection of code-quality analyzers. Covers usages of async methods, flags enums, best practices in exception handling as well as many other code-quality checks.

Libraries and Frameworks for Testing Analyzers, Code Fixes, and Refactorings

Microsoft.CodeAnalysis.Testing

Library for testing analyzers and code fixes with NUnit, xUnit and MSTest frameworks. A part of Roslyn SDK.

In 2 lists

RoslynTestKit

Lightweight framework for writing unit tests for analyzers, code fixes, refactorings, and completion providers. It's unit testing framework agnostic.

Source Generators

DpDtInject

Proof-of-concept of a dependency injection container that transfers huge piece of resolving logic to the compilation stage. Offers additional compile-time safety and fast runtime resolution.

In 2 lists

Generator.Equals

Automatically implements equality and hashing for classes and records. Supports different comparison strategies. Offers similar functionality like IL weaving-based Equals.Fody.

In 2 lists

JsonSrcGen

Reflection-free JSON serializer. Allows extremely fast JSON processing by generating reflection-free serializers at the compile time.

In 2 lists

Source Generator Playground

Online application that lets you experiment with source generators. Perfect for learning and testing your ideas. Write your own source generator or learn from built-in examples and see the generated output.

StrongInject

Compile-time dependency injection container. Compile-time checked, reflection-free and runtime code generation free, thus fast and app-trimming-friendly.

In 2 lists

StructPacker

Low-level, lightweight and performance-focused serializer for C# struct types. Auto-generates C# serialization code to achieve peak runtime performance and efficiency.

In 3 lists

Svg to C# Source Generators

SVG to C# compiler. Compiles SVG drawing markup to C# using SkiaSharp as rendering engine.

WrapperValueObject

Creates boilerplate free wrappers around types. Especially useful for creating strongly typed wrappers around primitive types.

In 2 lists

Blog Posts and Articles

How Microsoft rewrote its C# compiler in C# and made it open source

Roslyn's journey, presented by Mads Torgersen, the lead designer of C#. Inspiring story on how Roslyn project started and why, and what it took to make it open source.

Inside the .NET Compiler Platform – Performance Considerations during Syntax Analysis (#SpeakRoslyn)

In-depth look at Roslyn's performance with the focus on memory consumption.

Persistence, Facades and Roslyn's Red-Green Trees

Inspiring introduction on how Roslyn team implemented immutable, reusable trees with cheap parent references and many other goodies. Quote: "But on the Roslyn team we routinely do impossible things" :-)

ReSharper and Roslyn: Q&A

Excellent explanation why ReSharper will not use Roslyn. Includes good discussion on static code analysis and some limits of Roslyn.

Roslyn performance (Matt Gertz)

Insight on how Roslyn team approaches the topic of evaluating and achieving performance.

Talks

The Power of Roslyn

Great talk by Kasey Uhlenhuth at NDC Oslo 2018 covering Roslyn essentials and APIs and tools for building code analyzers and fixes.

See category
94

Awesome Rust

rust-unofficial/awesome-rust

A curated list of Rust code and resources.

Fresh★ 60k1833 entriesPushed today
94

Awesome Mac

jaywcjlove/awesome-mac

 This project is dedicated to collecting high-quality macOS software and organizing them systematically by different categories for easy search and use.

Fresh★ 115k1316 entriesPushed today
94

Awesome Python

vinta/awesome-python

Curated Python frameworks, libraries and resources.

Fresh★ 324k504 entriesPushed today
94

Awesome C++

fffaraz/awesome-cpp

A curated list of awesome C++ (or C) frameworks, libraries, resources, and shiny things. Inspired by awesome-... stuff.

Fresh★ 74k1358 entriesPushed yesterday
94

Awesome Go

avelino/awesome-go

Curated Go frameworks and libraries.

Fresh★ 186k3119 entriesPushed yesterday
94

Awesome PHP

ziadoz/awesome-php

A curated list of amazingly awesome PHP libraries, resources and shiny things.

Fresh★ 33k87 entriesPushed 2 days ago