## Executive Summary

In this session, **Drew Noakes**, **Jake**, and **Emmanuel** reveal the architectural reinvention of **C# Dev Kit 11** for Visual Studio Code. Rather than an incremental update, C# Dev Kit 11 represents a complete ground-up rewrite engineered to meet the demands of modern development environments where humans and multiple autonomous AI agents work concurrently on large solutions.

The team exposes how uncoordinated build operations previously consumed immense machine resources, causing developer machines with even 256 GB of RAM to lock up. To solve this, the team introduced two foundational innovations pushed deep into Roslyn and the .NET SDK: the **Language Service Cache (`.lscache`)** and the **BuildX Incremental Build Engine**. Together with the new **MSBuild Coordinator**, these technologies yield a **77% reduction in workspace load times**, an **80% reduction in memory footprint**, a **97% reduction in no-op build overhead**, and instant cross-worktree developer experiences.

### Core Breakthroughs & Architecture Highlights:
1. **The Multi-Agent Concurrency Crisis:** Developer environments have shifted from single-user scenarios to setups running 5 to 15 concurrent AI coding agents. Without coordination, each agent spawns dedicated MSBuild worker processes, oversaturating CPU cores and consuming hundreds of gigabytes of RAM.
2. **Language Service Cache (`.lscache`):** Decouples project metadata extraction from expensive runtime MSBuild evaluation. The pre-compile input data (resolved source files, globs, package references, target frameworks) is serialized to disk in milliseconds. Instead of taking hundreds to thousands of milliseconds per project, tools read project state in **1–2 milliseconds**.
3. **Open-Source Roslyn & SDK Integration:** The `.lscache` infrastructure was contributed directly to the open-source **Roslyn** repository and baked into the .NET SDK, ensuring that every build tool across the ecosystem can emit and consume the cache.
4. **Workspace Load Benchmarks:** Workspace startup time dropped by **~77%** across large-scale open-source solutions (Orleans, Roslyn, ILSpy). Memory allocated by the C# Dev Kit server dropped by **80%** (allowing 5 full IDE/agent instances in the footprint of 1 legacy instance).
5. **BuildX (Incremental Build Engine):** Bypasses MSBuild invocation overhead for incremental builds. Analyzes project dependency graphs, evaluates up-to-date states in milliseconds, and directly copies compiled binaries to dependent project outputs.
6. **Aspire Build Acceleration:** On the massive 400+ project .NET Aspire solution, building after a single file edit dropped from **36.1 seconds to 2.1 seconds**. No-op build overhead plummeted by **97%** (from 34.4s down to 0.9s).
7. **MSBuild Coordinator:** A centralized resource manager and priority queue (co-authored with Dustin Campbell) that caps global build concurrency and prioritizes active human focus (foreground IDE window) over background agents.
8. **Git Worktree Sharing:** Multiple Git worktrees seamlessly share `.lscache` files, compiled binaries, PDBs, and NuGet packages, slashing the fixed initialization cost of spinning up disposable agent worktrees.
9. **Agent Intent Optimization:** Vision for detouring agent-issued `dotnet build` and `dotnet test` commands into intent-based shortcuts (e.g. querying Roslyn LSP for compiler diagnostics without compiling, running only impacted tests via Git diff analysis).

---

## Detailed Section-by-Section Breakdown

### 1. The Multi-Agent Machine Freeze: Genesis of the Redesign

**Presenter:** Jake

Jake describes an internal escalation from a partner engineering team working on high-end machines (256 GB RAM). The team reported that VS Code and C# Dev Kit were constantly freezing. Diagnostic dumps revealed the root cause: the engineers had shifted to multi-agent workflows, running 5 to 15 autonomous agents concurrently to solve GitHub issues.

![Agent Machine Resource Exhaustion](/dotnetconf2026/archive/09-csharp-dev-kit-11/screenshots/01_agent_machine_resource_freeze.webp)

Each agent was independently triggering builds, test runs, and project evaluations. This unleashed hundreds of concurrent MSBuild worker processes that devoured all 256 GB of memory and locked the operating system. Jake tested an initial prototype build queue that serialized builds; counter-intuitively, overall agent throughput *increased* because CPU cache contention and memory thrashing were eliminated.

---

### 2. Anatomy of a Build & The "Design-Time" Tax

**Presenter:** Drew Noakes

Drew explains that developers and tools perform far more builds than they realize. Conceptually, builds consist of three distinct phases:
1. **Pre-Compile:** Evaluates project files, expands globbing patterns, resolves multi-targeted package references, and determines compiler arguments.
2. **Compile:** Invokes Roslyn (`csc.exe`) to emit assemblies.
3. **Post-Compile:** Copies output artifacts and satellite assemblies.

![Anatomy of a Build and Project Truth](/dotnetconf2026/archive/09-csharp-dev-kit-11/screenshots/02_anatomy_of_a_build_precompile.webp)

Development tools (VS Code, Visual Studio, `dotnet watch`, `dotnet test`, `dotnet format`) do not need the emitted binaries for language services—they only need the **Pre-Compile inputs**. Historically, tools repeatedly ran heavy "design-time builds" via MSBuild to extract this metadata, incurring hundreds of milliseconds of overhead per project.

---

### 3. Language Service Cache (`.lscache`)

To eliminate redundant project evaluations, C# Dev Kit 11 captures pre-compile data during standard builds and serializes it to a compact, compressed `.lscache` file on disk:
- **Write Cost:** Practically zero overhead because the data is already computed during the build.
- **Read Cost:** ~1–2 milliseconds per project, compared to 500–2,000+ milliseconds for an MSBuild design-time evaluation.
- **Universal Availability:** Written directly into Roslyn and the .NET SDK so all CLI and IDE tools can consume it.

![Language Service Cache Architecture](/dotnetconf2026/archive/09-csharp-dev-kit-11/screenshots/03_ls_cache_shared_architecture.webp)

---

### 4. Workspace Load & Memory Benchmarks

The real-world impact of the `.lscache` architecture on solution initialization is transformative:
- **Load Time:** Slashed by **77%** across Orleans, Roslyn, and ILSpy solutions. Smaller everyday solutions load almost instantaneously.
- **Memory Consumption:** Server memory consumption dropped by **80%**. The Roslyn codebase footprint in memory went from ~2 GB down to ~300 MB.

![Workspace Load Benchmarks: 77% Reduction](/dotnetconf2026/archive/09-csharp-dev-kit-11/screenshots/04_workspace_load_benchmarks_77pct.webp)
![C# Dev Kit Server Memory Reduction: 80% Less Allocation](/dotnetconf2026/archive/09-csharp-dev-kit-11/screenshots/05_memory_reduction_80pct.webp)

This 5x density improvement means a single developer machine can now run a human IDE session plus 4 background agent sessions within the exact same memory footprint previously occupied by one IDE.

---

### 5. BuildX: Fast Incremental Builds via Binary Acceleration

Drew introduces **BuildX**, an advanced incremental build engine integrated into C# Dev Kit and planned for CLI toolchains:
- In a multi-project reference graph (e.g. project $H$ at the base with dependent projects $A$ through $G$), changing code in $H$ requires recompiling $H$ and updating references.
- Rather than orchestrating the full MSBuild execution pipeline for every dependent project, BuildX determines project freshness in milliseconds.
- For dependent projects whose interface did not change, BuildX **accelerates** the build by directly copying the new output binaries from $H$ to dependent output directories without invoking MSBuild.

![BuildX Project Dependency Graph Acceleration](/dotnetconf2026/archive/09-csharp-dev-kit-11/screenshots/06_buildx_dependency_graph_acceleration.webp)

---

### 6. Aspire Solution Benchmarks: 36.1s to 2.1s

Testing BuildX on the massive .NET Aspire solution (over 400 projects) demonstrated extreme performance gains:
- **Single File Change Build:** Slashed from **36.1 seconds down to 2.1 seconds** (>94% reduction).
- **No-Op Build (Zero Changes):** Slashed from **34.4 seconds down to 0.9 seconds** (**97% reduction** in overhead).

![Aspire Build Benchmark Results](/dotnetconf2026/archive/09-csharp-dev-kit-11/screenshots/07_aspire_build_benchmarks_36s_to_2s.webp)

---

### 7. Live Demo: GitHub Copilot App into VS Code

**Presenter:** Emmanuel

Emmanuel demonstrates an end-to-end development workflow:
1. GitHub Copilot executes an autonomous task in `.NET eShop`, creates an automated test, builds, and fails the test as expected.
2. The developer transitions from the Copilot App directly into VS Code.
3. Because the Copilot action already built the project, C# Dev Kit 11 reads the `.lscache` immediately: IntelliSense, semantic colorization, and gutter test runners light up in milliseconds.
4. Emmanuel edits the discount logic and re-runs the test; BuildX compiles and verifies the fix instantly.

![GitHub Copilot to VS Code Inner Loop Demo](/dotnetconf2026/archive/09-csharp-dev-kit-11/screenshots/08_copilot_to_vscode_inner_loop.webp)

---

### 8. MSBuild Coordinator: Prioritizing the Human

**Presenter:** Emmanuel & Jake

To address multiple agents running concurrent builds across different terminal windows and worktrees, the team (in collaboration with **Dustin Campbell**) built the **MSBuild Coordinator**:
- **Central Concurrency Throttle:** Intercepts build requests across the OS and queues them against available hardware cores.
- **Human-First Priority Queue:** Infers user focus (e.g. active VS Code window) to prioritize the developer's interactive build while background agent builds pause.
- **De-duplication:** Suppresses design-time builds if an agent is already performing a real build for that project.

![MSBuild Coordinator and Queue Management](/dotnetconf2026/archive/09-csharp-dev-kit-11/screenshots/09_msbuild_coordinator_queue.webp)

---

### 9. Command-Line BuildX & Orchard Core Demo

Emmanuel runs BuildX directly from the command line against **Orchard Core**:
- A no-op build completes instantly in 0.0 seconds.
- Switching to a branch modifying a core abstraction triggers BuildX: only the modified abstraction and its immediate consumer recompile. Hundreds of downstream dependent projects are accelerated via binary copying in fractions of a second.

![BuildX Orchard Core Command Line Demo](/dotnetconf2026/archive/09-csharp-dev-kit-11/screenshots/10_cli_buildx_orchard_core_demo.webp)

---

### 10. What Comes Next: Agent-First Optimizations & Git Worktrees

The presenters conclude with an architectural look at future capabilities:
- **Detouring Agent Tool Calls:** When an AI agent executes `dotnet build` just to check for compile errors, the toolchain can intercept the command and query the in-memory Roslyn LSP diagnostics server directly, returning errors in milliseconds without invoking the compiler.
- **Intent-Based Test Execution:** When an agent runs `dotnet test`, the system infers modified code and executes only impacted tests rather than full test suites.
- **Cross-Worktree Resource Sharing:** Extending `.lscache`, compiled binaries, PDBs, and NuGet caches across Git worktrees, making spinning up dozens of disposable agent worktrees virtually cost-free.
