Automate Yourself Out of a Job with Roslyn
summary
Roslyn is Microsoft's compiler-as-a-service and the talk shows how to use Roslyn Workspaces plus Microsoft.Build.Locator to load solutions, then read SyntaxTrees, get semantic models and symbols, and traverse with a SyntaxWalker or transform code with a Syntax Rewriter (immutability creates new Solution instances and TryApplyChanges can fail like a merge conflict). Examples include generating protobuf from WCF to create a gRPC proxy that works, a string-literal upshifter, and an analyzer with Diagnostic analyzer + CodeFix that wraps DiagnosticSource.Write with IsEnabled, plus unit tests using the CodeFixVerifier.
AI-written summary · about
chapters (20)
- 0:00Introduction to Roslyn
- 1:14What is Roslyn?
- 5:05Getting started with Roslyn
- 6:31Understanding Workspaces
- 8:27Locating MSBuild and projects
- 11:51Syntax Trees and Visualizer
- 14:22Navigating Syntax with LINQ
- 17:56Using Syntax Walkers
- 20:29Semantic Models and Symbols
- 22:30Exploring Symbols
- 25:26Using Symbol Visitors
- 27:07Analyzing Project Types
- 30:44Rewriting Code
- 32:57Syntax Rewriters
- 37:46Practical Code Generation
- 39:33Roslyn Analyzers
- 44:00Creating an Analyzer
- 46:52Testing the Analyzer
- 50:04Code Fix Providers
- 55:26Testing and Conclusion
related talks
01h 16mAutomate yourself out of a job with Roslyn
01h 08mAnalyzing source code using Roslyn
30mRoslyn for teamlead.If something takes more than 5 minutes -write a script.
01h 01mThe Power of Roslyn
01h 02mUse your source code to document your application
57mRoslyn: The Craft of Static Analysis
01h 01mWriting Code with Code: Getting Started with the Roslyn APIs
50mAnalyzing Code in .NET
