cover
Title Page
Copyright
Roslyn Cookbook
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Why subscribe?
Customer Feedback
Dedication
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
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
Getting ready
How to do it...
How it works...
There s more...
See also
Creating a syntax node analyzer to report issues about language syntax
Getting ready
How to do it...
How it works...
Creating a syntax tree analyzer to analyze the source file and report syntax issues
Getting ready
How to do it...
How it works...
Creating a method body analyzer to analyze whole method and report issues
Getting ready
How to do it...
How it works...
Creating a compilation analyzer to analyze whole compilation and report issues
Getting ready
How to do it...
How it works...
Writing unit tests for an analyzer project
Getting ready
How to do it...
How it works...
See also
Publishing NuGet package and VSIX for an analyzer project
Getting ready
How to do it...
Consuming Diagnostic Analyzers in .NET Projects
Introduction
Searching and installing analyzers through the NuGet package manager
Getting ready
How to do it...
Searching and installing VSIX analyzers through the VS extension gallery
Getting ready
How to do it...
Viewing and configuring analyzers in solution explorer in Visual Studio
Getting ready
How to do it...
How it works...
Using the ruleset file and Rule Set editor to configure analyzers
Getting ready
How to do it...
How it works...
There's more...
Writing IDE Code Fixes Refactorings and Intellisense Completion Providers
Introduction
Creating debugging and executing a CodeFixProvider to fix a compiler warning
Getting ready
How to do it...
How it works...
Applying batch code fixes (FixAll) across different scopes: document project and solution
Getting ready
How to do it...
Creating a custom FixAllProvider to fix all occurrences of an issue across a scope
Getting ready
How to do it...
How it works...
Creating a CodeRefactoringProvider to refactor source code to recommend using C# 7.0 tuples
Getting ready
How to do it...
How it works...
There s more...
Creating a CompletionProvider to provide additional intellisense items while editing code.
Getting ready
How to do it...
How it works...
Writing unit tests for a CodeFixProvider
Getting ready
How to do it...
How it works...
Improving Code Maintenance of C# Code Base
Introduction
Configuring C# code style rules built into Visual Studio 2017
Getting ready
How to do it...
How it works...
There is more...
Using the .editorconfig file for configuration of code style rules
Getting ready
How to do it...
How it works...
Using the public API analyzer for API surface maintenance
Getting ready
How to do it...
How it works...
There's more...
Using third-party StyleCop analyzers for code style rules
Getting ready
How to do it...
How it works...
Catch Security Vulnerabilities and Performance Issues in C# Code
Introduction
Identifying configuration-related security vulnerabilities in web applications
Getting ready
How to do it...
How it works...
Identifying cross-site scripting vulnerabilities in view markup files (.cshtml .aspx files) in web applications
Getting ready
How to do it...
How it works...
Identifying insecure method calls that can lead to SQL and LDAP injection attacks
Getting ready
How to do it...
How it works...
Identifying weak password protection and management in web applications
Getting ready
How to do it...
Identifying weak validation of data from external components to prevent attacks such as cross-site request forgery and path tampering
Getting ready
How to do it...
Identifying performance improvements to source code using FxCop analyzers
Getting ready
How to do it...
How it works...
Live Unit Testing in Visual Studio Enterprise
Introduction
Running live unit tests in Visual Studio for unit test projects based on NUnit XUnit and MSTest frameworks
Getting started
How to do it
Viewing and navigating live unit test results
Getting started
How to do it...
Understanding incremental live unit test execution with code changes
Getting started
How to do it...
How it works
Understanding Start/Stop/Pause/Continue/Restart functionality for fine grain control of LUT
Getting started
How to do it...
Including and excluding subset of tests for live execution
Getting started
How to do it...
Configuring different options for live unit testing using the Tools Options dialog
Getting started
How to do it...
C# Interactive and Scripting
Introduction
Writing a simple C# script and evaluating it within the Visual Studio interactive window
Getting started
How to do it...
How it works...
Using script directives and REPL commands in the C# interactive window
Getting started
How to do it...
Using keyboard shortcuts for evaluating and navigating through script sessions in the C# interactive window
Getting started
How to do it...
Initializing the C# interactive session from the existing C# project
Getting started
How to do it...
Executing the C# script on a Visual Studio developer command prompt using csi.exe
Getting started
How to do it...
Using the Roslyn scripting API to execute C# code snippets
Getting started
How to do it...
How it works...
Contribute Simple Functionality to Roslyn C# Compiler Open Source Code
Introduction
Setting up Roslyn enlistment
Getting Started
How to do it...
Implementing a new syntax error in the C# compiler code base
Getting Started
How to do it...
How it works...
Implementing a new semantic error in the C# compiler code base
Getting Started
How to do it...
How it works...
Writing unit tests for a new error in the C# compiler code base
Getting Started
How to do it...
Using Roslyn Syntax Visualizer to view Roslyn syntax tokens and nodes for a source file
Getting Started
How to do it...
Sending a Roslyn pull request to contribute to next version of C# compiler and VS IDE
Getting Started
How to do it...
Design and Implement a New C# Language Feature
Introduction
New language feature: Switch Operator (?::)
Designing syntax and grammar for a new C# language feature
Getting Started
How to do it...
How it works...
Implementing parser support for a new C# language feature
Getting Started
How to do it...
How it works...
Implementing binding/semantic analysis support for a new C# language feature
Getting Started
How to do it...
How it works...
There's more...
Implementing lowering/code generation support for a new C# language feature
Getting Started
How to do it...
How it works...
Writing unit tests for C# parsing binding and codegen phases
Getting Started
How to do it...
Command-Line Tools Based on Roslyn API
Introduction
Writing an application based on the Compiler Syntax API to parse and transform source files
Getting started
How to do it...
How it works...
Writing an application based on the Compiler Semantic API to display diagnostics and overload resolution results
Getting started
How to do it...
How it works...
Writing an application based on the Compiler Analyzer API to execute diagnostic analyzers and display analyzer diagnostics
Getting started
How to do it...
How it works...
Writing an application based on the Workspaces API to format and simplify all source files in the solution
Getting started
How to do it...
How it works...
Writing an application based on the Workspaces API to edit projects in a solution and display project properties
Getting started
How to do it...
How it works...
更新时间:2021-07-15 17:08:20