My Account Log in

2 options

Roslyn cookbook : compiler as a service, static code analysis, code quality, code generation, and more / Manish Vasani.

Ebook Central College Complete Available online

View online

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Vasani, Manish, author.
Language:
English
Subjects (All):
Microsoft .NET Framework.
Compilers (Computer programs).
Optimizing compilers.
Programming software.
Physical Description:
1 online resource (241 pages) : illustrations
Edition:
1st edition
Place of Publication:
Birmingham, England ; Mumbai, India : Packt Publishing, 2017.
System Details:
text file
Summary:
Use Roslyn as a service to write powerful extensions and tools and use them in Visual Studio to improve code quality and maintain your source code more effectively. About This Book Use Roslyn extensions and tools in Visual Studio to enforce "house rules" on code and fix security and performance vulnerabilities in your code. Write Roslyn extensions using the Roslyn service API to help developers enforce conventions and design idioms. Improve developer productivity by using Roslyn-based agile development features in Visual Studio, such as live unit testing, C# interactive and scripting. Contribute to the C# language and compiler tool chain to analyze and edit code. Who This Book Is For .NET Developers and architects, who are interested in taking full advantage of the Roslyn based extensions and tools to improve the development processes, will find this book useful. Roslyn contributors, i.e. the producers and C# community developers, will also find this book useful What You Will Learn Write extensions to analyze source code and report warnings and errors. Edit C# source code to fix compiler/analyzer diagnostics or refactor source code. Improve code maintenance and readability by using analyzers and code fixes. Catch security and performance issues by using PUMA scan analyzers and FxCop analyzers. Perform Live Unit tests in Visual Studio. Use C# interactive and scripting in Visual Studio. Design a new C# language feature and implement various compiler phases for a new language feature. Write command line tools to analyze and edit C# code. In Detail 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: 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 re...
Contents:
Cover
Copyright
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Customer Feedback
Table of Contents
Preface
Chapter 1: Writing Diagnostic Analyzers
Introduction
Creating, debugging, and executing an analyzer project in Visual Studio
Getting ready
How to do it…
How it works…
Creating a symbol analyzer to report issues about symbol declarations
There's more…
See also
Creating a syntax node analyzer to report issues about language syntax
Creating a syntax tree analyzer to analyze the source file and report syntax issues
Creating a method body analyzer to analyze whole method and report issues
Creating a compilation analyzer to analyze whole compilation and report issues
Writing unit tests for an analyzer project
How it works...
Publishing NuGet package and VSIX for an analyzer project
Chapter 2: Consuming Diagnostic Analyzers in .NET Projects
Searching and installing analyzers through the NuGet package manager
Searching and installing VSIX analyzers through the VS extension gallery
Viewing and configuring analyzers in solution explorer in Visual Studio
Using the ruleset file and Rule Set editor to configure analyzers
Chapter 3: Writing IDE Code Fixes, Refactorings, and Intellisense Completion Providers.
Introduction
Creating, debugging, and executing a CodeFixProvider to fix a compiler warning
Applying batch code fixes (FixAll) across different scopes: document, project, and solution
Creating a custom FixAllProvider to fix all occurrences of an issue across a scope
Creating a CodeRefactoringProvider to refactor source code to recommend using C# 7.0 tuples
Creating a CompletionProvider to provide additional intellisense items while editing code.
Writing unit tests for a CodeFixProvider
Chapter 4: Improving Code Maintenance of C# Code Base
Configuring C# code style rules built into Visual Studio 2017
There is more...
Using the .editorconfig file for configuration of code style rules
Using the public API analyzer for API surface maintenance
Using third-party StyleCop analyzers for code style rules
Chapter 5: Catch Security Vulnerabilities and Performance Issues in C# Code
Identifying configuration-related security vulnerabilities in web applications
Identifying cross-site scripting vulnerabilities in view markup files (.cshtml, .aspx files) in web applications
Identifying insecure method calls that can lead to SQL and LDAP injection attacks.
Getting ready
Identifying weak password protection and management in web applications
Identifying weak validation of data from external components to prevent attacks such as cross-site request forgery and path tampering
Identifying performance improvements to source code using FxCop analyzers
Chapter 6: Live Unit Testing in Visual Studio Enterprise
Running live unit tests in Visual Studio for unit test projects based on NUnit, XUnit, and MSTest frameworks
Getting started
Viewing and navigating live unit test results
How to do it...
Understanding incremental live unit test execution with code changes
Understanding Start/Stop/Pause/Continue/Restart functionality for fine grain control of LUT
Including and excluding subset of tests for live execution
Configuring different options for live unit testing using the Tools Options dialog
Chapter 7: C# Interactive and Scripting
Writing a simple C# script and evaluating it within the Visual Studio interactive window
Using script directives and REPL commands in the C# interactive window
Using keyboard shortcuts for evaluating and navigating through script sessions in the C# interactive window
Initializing the C# interactive session from the existing C# project
How to do it….
Executing the C# script on a Visual Studio developer command prompt using csi.exe
Using the Roslyn scripting API to execute C# code snippets
Chapter 8: Contribute Simple Functionality to Roslyn C# Compiler Open Source Code
Setting up Roslyn enlistment
Getting Started
Implementing a new syntax error in the C# compiler code base
Implementing a new semantic error in the C# compiler code base
Writing unit tests for a new error in the C# compiler code base
Using Roslyn Syntax Visualizer to view Roslyn syntax tokens and nodes for a source file
Sending a Roslyn pull request to contribute to next version of C# compiler and VS IDE
Chapter 9: Design and Implement a New C# Language Feature
New language feature: Switch Operator (?::)
Designing syntax and grammar for a new C# language feature
Implementing parser support for a new C# language feature
Implementing binding/semantic analysis support for a new C# language feature
There's more...
Implementing lowering/code generation support for a new C# language feature
Writing unit tests for C# parsing, binding, and codegen phases
Chapter 10: Command-Line Tools Based on Roslyn API
Introduction.
Writing an application based on the Compiler Syntax API to parse and transform source files
Writing an application based on the Compiler Semantic API to display diagnostics and overload resolution results
Writing an application based on the Compiler Analyzer API to execute diagnostic analyzers and display analyzer diagnostics
Writing an application based on the Workspaces API to format and simplify all source files in the solution
Writing an application based on the Workspaces API to edit projects in a solution and display project properties
Index.
Notes:
Includes index.
Description based on online resource; title from PDF title page (ebrary, viewed August 25, 2017).
OCLC:
1001347194

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account