Free Intensive Nov 21–22Free 2-day hands-on Vibecoding Intensive on Nov 21–22 at 16:00 MSK (Sat–Sun) · Live Cohort 3 starts Nov 23Join Free →Cohort 3 (Nov 23)
ReleaseCode / SDK · ActionableHabr AI→ original

Microsoft Ships .NET 11: C# 15 Adds Union Types and an MCP Server Template for AI Agents

Microsoft has released .NET 11, the new version of its application platform, together with C# 15. The headline feature, union types, lets you declare that a method returns either a successful result or an error, and the compiler will not let you forget to handle both cases. For AI projects, Microsoft added an MCP server template: a ready-made service skeleton that AI clients connect to as a set of tools. That makes it easier for .NET teams to build agents on a stack they already know.

AI-processed from Habr AI; edited by Hamidun News
Microsoft Ships .NET 11: C# 15 Adds Union Types and an MCP Server Template for AI Agents
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
.NET 11 is an STS releasetwo years of support; for long-term needs, .NET 10 LTS is still available
Key metric #2SDK and Runtime builds are available for Windows, Linux, and macOS
Key metric #3EF Core 11 adds FullJoin, and the libraries gain Zstandard compression

Every .NET developer knows this situation: a method returns either a result or an error, and somewhere in the code one of the cases was forgotten. The bug surfaces only in production. Microsoft has released .NET 11, the new version of its open-source application development platform, along with the C# 15 language. The main idea of the release is to hand these checks over to the compiler. The platform also gets scaffolding for AI applications, including an MCP server template. It is a ready-made service skeleton that AI clients connect to as a set of tools.

Union Types and Closed Hierarchies: The Compiler Checks Your Work

The main new feature in C# 15 is union types. They let you specify in advance which types are allowed for a single value. The announcement's example describes an operation result as a union of two types: a successful response and an error. If you write code that unpacks this result, the compiler makes sure all the variants are handled. Forgetting to handle the error becomes harder.

The second new feature follows the same idea: closed class hierarchies. If a class is marked with the closed modifier, it can only be inherited directly within the same assembly. This means the compiler knows the full list of subclasses in advance. In a switch construct, it will verify that you have handled each of them. If a new subclass is later added to the assembly and its handling is forgotten, this shows up at compile time rather than in front of users.

In practice, models such as "result or error" or "one of several commands" can now be expressed in the type itself, rather than in verbal agreements within a team.

Faster Build and Runtime, More Library Capabilities

In the SDK, the precompiled version of the dotnet command-line tool and the MSBuild server are now enabled by default. The server stays running between commands, so repeated operations should run faster. The SDK installation packages for Linux and macOS have been reduced in size by removing duplicate files.

The team continued optimizing the Runtime and the JIT compiler. Improvements cover branching, array bounds checks, and interface calls. For Native AOT, the amount of generated code has been reduced. On Linux and macOS, more information about the program's state can now be saved when a crash occurs, which helps when analyzing failures.

The standard libraries gain Zstandard compression support, new JSON capabilities, and several ways to work with in-memory data without preliminary copying. Entity Framework Core 11 receives additional query optimizations and FullJoin support. For SQL Server, experimental support for vector indexes and search has been added. The word "experimental" matters: for critical systems, this is a reason to test, not to migrate.

What the Release Offers for AI Development

Microsoft singled out AI applications separately. The MCP server template is meant to quickly build a service that AI clients can call for tools: database search, calls to an internal API, and so on. The Microsoft.Extensions.AI library provides a unified set of interfaces for connecting models, so the code is less tied to a specific provider. Microsoft Agent Framework is designed for building agents that use tools, maintain state, and operate within more complex workflows.

For teams already writing in .NET, this makes it possible to build agents and MCP servers on a familiar stack. Learning Python specifically for this is not required, although the choice depends on the task and the ecosystem.

What to Consider Before Upgrading

.NET 11 is an STS (Standard Term Support) release and will be supported for two years. If a project needs a longer support window, Microsoft still recommends .NET 10 LTS. A practical plan is to try .NET 11 on new or experimental services, evaluate union types and closed hierarchies on a small part of the codebase, and keep production systems with long lifecycles on LTS. SDK and Runtime builds are available for Windows, Linux, and macOS, so the new version can be tested on any working machine.

The announcement contains no benchmarks or exact speedup figures, so claims about "faster repeated operations" should be verified on your own projects. The main practical effect of the release is more checks at compile time and ready-made scaffolding for AI services built into the platform itself.

Story

Key Questions Answered

What are the key details on Union Types and Closed Hierarchies: The Compiler Checks Your Work?

The main new feature in C# 15 is union types. They let you specify in advance which types are allowed for a single value. The announcement's example describes an operation result as a union of two types: a successful response and an error. If you write code that unpacks this result, the compiler makes sure all the variants are handled. Forgetting to handle the error becomes harder. The second new feature follows the same idea: closed class hierarchies.

What are the key details on Faster Build and Runtime, More Library Capabilities?

In the SDK, the precompiled version of the dotnet command-line tool and the MSBuild server are now enabled by default. The server stays running between commands, so repeated operations should run faster. The SDK installation packages for Linux and macOS have been reduced in size by removing duplicate files. The team continued optimizing the Runtime and the JIT compiler. Improvements cover branching, array bounds checks, and interface calls. For Native AOT, the amount of generated code has been reduced.

What the Release Offers for AI Development?

Microsoft singled out AI applications separately. The MCP server template is meant to quickly build a service that AI clients can call for tools: database search, calls to an internal API, and so on. The Microsoft.Extensions.AI library provides a unified set of interfaces for connecting models, so the code is less tied to a specific provider. Microsoft Agent Framework is designed for building agents that use tools, maintain state, and operate within more complex workflows.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…