Metalama 2026.0 Generally Available: Full Support for C# 14 and .NET 10
Metalama 2026.0 is now generally available! This major release brings full support for C# 14—the most significant evolution of the C# language in years—along with .NET 10 SDK and Visual Studio 2026 compatibility. We’re also closing one of the last feature gaps with PostSharp: the ability to override event handler invocations. And you’re getting first-class support for tuple types.
Ready to try it? The packages are on NuGet.org, and the Visual Studio extension is available from the Visual Studio Marketplace.
For the complete list of changes, see the release notes. For an even more details, see the change notes for the releases 2026.0.11, 2026.0.10-rc, 2026.0.9-rc, 2026.0.8-rc, 2026.0.7-rc, 2026.0.6-rc, 2026.0.5-preview, 2026.0.4-preview, 2026.0.3-preview, 2026.0.2-preview, 2026.0.1-preview.
C# 14 support
C# 14 introduces several language features, and Metalama 2026.0 supports all of them in user code:
- Extension blocks (see below)
- Null-conditional assignments
fieldkeyword in properties- Partial constructors and events
- Compound assignment operators
- Simple lambda parameters with modifiers
However, some features are not yet supported in aspects:
- Null-conditional assignments in templates
- The
fieldkeyword in templates - Generating run-time code for extension members via invoker interfaces
- Adding contracts to the receiver parameter of extension blocks
- Introducing new compound assignment operators
- Introducing parameters into partial constructors
- Introducing new extension blocks
Extension blocks
Extension blocks are the headline feature of C# 14, letting you extend any type with new members. Metalama provides comprehensive support:
- Extension blocks are modeled via the
IExtensionBlockinterface, which implementsINamedType(TypeKind = Extension). - They appear under
INamedType.ExtensionBlocks. - You can override extension members using the advising API or apply aspects via custom attributes.
- You can introduce new members into existing extension blocks.
- Introducing new extension blocks is not yet supported.
Here’s how to add logging to all extension methods in your project using a fabric:
public class Fabric : ProjectFabric
{
public override void AmendProject( IProjectAmender amender )
{
amender
.SelectTypes()
.SelectMany( t => t.ExtensionBlocks )
.SelectMany( e => e.Methods )
.AddAspectIfEligible<LogAttribute>();
}
}
Event handler overriding
You can now override event handler invocations, enabling patterns like “safe events” where each handler is isolated by exception handling. The OverrideInvoke method in OverrideEventAspect intercepts individual handler invocations.
Typical use cases:
- Safe events (exception isolation)
- Background or asynchronous event dispatch
- Event invocation logging
Here’s an aspect that catches exceptions and removes faulty handlers:
public class SafeEventAttribute : OverrideEventAspect
{
public override dynamic? OverrideInvoke( dynamic? handler )
{
try
{
return meta.Proceed();
}
catch ( Exception e )
{
Console.WriteLine( e );
meta.Target.Event.Remove( handler );
throw;
}
}
}
Apply it to any event:
public class Camera
{
[SafeEvent]
public event EventHandler? FocusChanged;
private void OnFocusChanged()
{
this.FocusChanged?.Invoke( this, EventArgs.Empty );
}
}
For details, see Overriding events.
First-class tuple support
Previously, Metalama treated tuples as plain INamedType objects—no access to element names or types. The new ITupleType interface changes that, making scenarios like packing method arguments for interceptors much cleaner:
// Create a tuple type from method parameters.
var tupleType = TypeFactory.CreateTupleType( method.Parameters );
// Create a tuple instance.
var tupleExpression = tupleType.CreateCreateInstanceExpression( meta.Target.Parameters );
// Pass it to an observer.
_myObserver.OnMethodCalled( method.DeclaringType.FullName, method.Name, tupleExpression.Value );
Metrics enhancements
- LinesOfCode metric: Three measurements—Logical, NonBlank, and Total.
- Workspaces API: Now officially supports metrics consumption.
Visual Studio tooling improvements
We’ve refactored several background components of our VSIX. It’s now more stable, consumes less CPU, and better utilizes your cores.
Claude Code skill for AI-assisted development
We’re introducing a Claude Code skill that gives Anthropic’s AI assistant comprehensive Metalama knowledge:
- Conceptual documentation
- API references
- Sample code and pattern libraries
Whether you’re new to Metalama or tackling a complex scenario, Claude can now provide contextually relevant guidance for aspect development, templates, fabrics, and the code model.
The skill is available on the Metalama.AI.Skills marketplace. For setup instructions, see Configuring Claude Code.
Documentation updates
We’ve made significant improvements:
- New: Working with types
- Improved: Writing T# templates
- Updated: Injecting dependencies into aspects (now covers cross-project DI)
- Updated: Overriding events
- New: Consuming code metrics and Custom metrics
- Enhanced API docs with integrated conceptual content
Breaking changes
- .NET 6 SDK is no longer supported.
- Several API and behavioral changes. See the release notes for details.
What’s next
With 2026.0 shipped, we’ll focus on extending C# 14 support in aspects.
Found an issue or have a feature request? Let us know on GitHub.
Happy meta-programming!
-gael