Writing Code with Code: Getting Started with the Roslyn APIs
summary
Demonstrates using the Roslyn APIs and Microsoft.CodeAnalysis.CSharp to turn a JSON/TypeScript-driven spec (processed with TS-morph) into a schema.json and then into C# syntax trees that emit thousands of classes in seconds. The pipeline targets a real Elasticsearch client: ~400 endpoints, ~2,000 data structures and a ~180,000-line spec. The generator parses the spec, builds a richer context, produces request/response/descriptor classes and test-checks via recorded integration traffic; it works for most endpoints today but needs refactoring and polishing.
AI-written summary · about
chapters (8)
- 0:00Start
- 4:01Analyzers and Code Fixes
- 8:58Compiler Flow
- 10:48Syntax Trees
- 19:56Options for Code Generation
- 37:19Validating the Specification
- 39:12Code Generation Pipeline
- 43:49NET Code Generator
related talks
50mAutomate Yourself Out Of a Job With Roslyn
54mExploring Source Generators
01h 08mAnalyzing source code using Roslyn
50mImproving Source Code with Roslyn
01h 01mBuilding Code Analyzers with the new C# compiler platform (Roslyn)
01h 02mRoslyn Source Generators Never send a human to do a machine's job
51mThe Future of C#
01h 01mDynamic Runtime Code with Roslyn
