Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Roslyn Cookbook
  • Table Of Contents Toc
  • Feedback & Rating feedback
Roslyn Cookbook

Roslyn Cookbook

By : Manish Vasani
close
close
Roslyn Cookbook

Roslyn Cookbook

By: Manish Vasani

Overview of this book

Open-sourcing the C# and Visual Basic compilers is one of the most appreciated things by the .NET community, especially as it exposes rich code analysis APIs to analyze and edit code. If you want to use Roslyn API to write powerful extensions and contribute to the C# developer tool chain, then this book is for you. Additionally, if you are just a .NET developer and want to use this rich Roslyn-based functionality in Visual Studio to improve the code quality and maintenance of your code base, then this book is also for you. This book is divided into the following broad modules: 1. Writing and consuming analyzers/fixers (Chapters 1 - 5): You will learn to write different categories of Roslyn analyzers and harness and configure analyzers in your C# projects to catch quality, security and performance issues. Moving ahead, you will learn how to improve code maintenance and readability by using code fixes and refactorings and also learn how to write them. 2. Using Roslyn-based agile development features (Chapters 6 and 7): You will learn how to improve developer productivity in Visual Studio by using features such as live unit testing, C# interactive and scripting. 3. Contributing to the C# language and compiler tool chain (Chapters 8 - 10): You will see the power of open-sourcing the Roslyn compiler via the simple steps this book provides; thus, you will contribute a completely new C# language feature and implement it in the Roslyn compiler codebase. Finally, you will write simple command line tools based on the Roslyn service API to analyze and edit C# code.
Table of Contents (11 chapters)
close
close

What this book covers

Chapter 1, Writing Diagnostic Analyzers, enables developers to write diagnostic analyzer extensions to the C# compiler and Visual Studio IDE to analyze source code and report warnings and errors. End users will see these diagnostics on building the project from the command line or Visual Studio and see them live while editing the source code in the Visual Studio IDE.

Chapter 2, Consuming Diagnostic Analyzers in .NET Projects, enables developers in the C# community to harness third-party Roslyn diagnostic analyzers for their C# projects. You will learn how to search, install, view, and configure diagnostic analyzers in Visual Studio.

Chapter 3, Writing IDE Code Fixes, Refactorings, and IntelliSense Completion Providers, enables developers to write code fix and code refactoring extensions to the Visual Studio IDE to edit C# source code to fix compiler/analyzer diagnostics and refactor source code, respectively. It also enables developers to write completion provider extensions to the C# IntelliSense in the Visual Studio IDE for an enhanced code editing experience.

Chapter 4, Improving Code Maintenance of C# Code Base, enables developers in the C# community to improve the code maintenance and readability of their source code by using the analyzers and code fixes that are built into the Visual Studio IDE, as well as some popular third-party implementations.

Chapter 5, Catch Security Vulnerabilities and Performance Issues in C# Code, enables C# community developers to catch security and performance issues in their C# code base by using popular third-party analyzers such as PUMA scan analyzers and FxCop analyers.

Chapter 6, Live Unit Testing in Visual Studio Enterprise, enables developers to use the new Roslyn-based feature in the Visual Studio 2017 Enterprise edition that enables smart live unit test (LUT) execution in the background. LUT automatically runs the impacted unit tests in the background as you edit code, and visualizes the results and code coverage live, in the editor, in real-time.

Chapter 7, C# Interactive and Scripting, enables developers to use C# interactive and scripting features in Visual Studio. C# scripting is a tool for quickly testing out C# and .NET snippets using a REPL (read-evaluate-print-loop), without the effort of creating multiple unit testing or console projects.

Chapter 8, Contribute Simple Functionality to Roslyn C# Compiler Open Source Code, enables developers to add new functionality to the open source Roslyn C# compiler. You will learn how to implement new C# compiler errors, add unit tests for them, and then send a pull request for your code changes to the Roslyn repo to incorporate them in the next version of the C# compiler.

Chapter 9, Design and Implement a New C# Language Feature, enables developers to design a new C# language feature and implement various compiler phases for this feature in the open source Roslyn C# compiler. You will learn the following aspects of compiler design and implementation: language design, parsing, semantic analysis and binding, and code generation, with suitable code examples.

Chapter 10, Command-Line Tools Based on Roslyn API, enables developers to write command-line tools using the Roslyn Compiler and Workspaces API to analyze and/or edit C# code.

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY