[Home](../) › [Blog](../blog) › Metalama 2025.0 Generally Available: Support for C# 13 and .NET 9, Aspect Framework Improvements, and More

# Metalama 2025.0 Generally Available: Support for C# 13 and .NET 9, Aspect Framework Improvements, and More

> Announcing the general availability of Metalama 2025.0: support for C# 13, .NET 9, Roslyn generators and interceptors; many improvements in the aspect framework; nearly doubled performance; async and background WPF commands.

Published: 2025-01-04 · Author: Gaël Fraiteur · Canonical: https://postsharp.net/blog/metalama-2025-0-ga

Metalama 2025.0 is now generally available! This release supports C# 13 and .NET 9, adds significant enhancements to the aspect framework, and nearly doubles performance.

This article highlights the most significant improvements. For a detailed discussion, see the [release notes](https://doc.metalama.net/conceptual/release-notes/release-notes-2025-0) of Metalama 2025.0.

Note that we are simultaneously releasing [PostSharp 2025.0](https://postsharp.net/blog/postsharp-2025-0-ga).

## C# 13 and .NET 9

The primary goal of Metalama 2025.0 is to support the new .NET stack. All new C# features and the new .NET SDK have been implemented and tested. This includes:

- `params` collections
- `ref`/`unsafe` in iterators and async methods
- `ref struct` can implement interfaces
- Classes can have `ref struct` constraints
- New escape character in strings
- Locking on the `Lock` class
- Implicit indexer access in object initializers
- Overload resolution priority
- `partial` properties

We've updated third-party dependencies.

Note that the minimum supported version of Visual Studio is now 17.6 LTSC (Roslyn 4.4).

## Support for code generators and interceptors

We've improved the integration of Metalama with code generators and interceptors. We now consistently execute source generators _after_ any Metalama transformation.

This approach has three benefits:

- It offers a consistent experience both at design time and build time.
- Aspects can introduce code that relies on code generators, such as the `[GeneratedRegex]` attribute.
- You can now use Roslyn interceptors alongside Metalama since they no longer conflict with our code transformations.

The downside is that you can no longer use Metalama aspects in Razor (`.cshtml`) pages.

## Aspect framework improvements

- **Closing gaps with introduced types.** You can now use introduced types in type constructs like `Foo[]`, `List<Foo>`, `Foo<Bar>`, or `Foo*`, where `Foo` is the introduced type.
- **Introduction of static virtual, abstract, and partial members.** We've lifted several limitations in member introductions.
- **Introduction of generic interfaces.** You can now implement a generic interface without limitation. Previously, for a class `Bar`, it was impossible to implement an interface `IFoo<Bar>`, which was crucial to implement, for instance, comparison patterns.
- **Introduction of extension methods.** You can now introduce extension methods by adding the `[This]` attribute to the first parameter of the template method or setting the `IParameterBuilder.IsThis` property.
- **Dynamic definition of local variables.** You can now dynamically define a local variable in a T# template thanks to the new `meta.DefineLocalVariable` method, which returns an `IExpression`.
- **Suppression of well-known warnings in aspects.** We now suppress some compiler warnings in aspect code because they are generally irrelevant given the meta-programming nature of the code.
- **Clean-up of IRef and overridden field representation.** We've refactored the implementation (and, to some extent, the public API) of the `IRef` interface and made the representation of overridden fields more consistent.

## Async and background WPF commands

The `[Command]` aspect now supports asynchronous and background commands:

- Asynchronous commands are those that return a `Task`.
- Background commands, whether synchronous or not, execute in a background thread instead of the UI thread.

Both asynchronous and background commands can be canceled through a `CancellationToken` parameter.

Thanks to extensive refactoring of the code model and other efforts, Metalama 2025.0 is almost twice as fast as 2024.2 under a typical workload.

The overhead of Metalama 2025.0 is about 60% of the overhead of the previous version. You should now find your builds are between 25% and 35% slower with Metalama than without it, depending on the number of aspects. At 25% to 35% overhead, performance should no longer be a concern when adopting Metalama.

For precise measurements and methodology, see [this blog post](https://postsharp.net/blog/metalama-performance).

## Bug fixes

We fixed 43 bugs in this release, most of them affecting the design-time experience. We are monitoring telemetry data to identify and prioritize remaining issues.

## Breaking changes

As noted above, we've updated all third-party dependencies to their latest versions. Also, the minimum supported version of Visual Studio is now 17.6 LTSC (Roslyn 4.4).

Additionally, we must declare a few breaking changes in the public API of `IRef` and `Metalama.Patterns.Commands`. For details, see the [release notes](https://doc.metalama.net/conceptual/release-notes/release-notes-2025-0#breaking-changes)

## Conclusion

Metalama 2025.0 is a strong release from several angles. It is a platform update, and it also closes most feature gaps in the aspect framework and nearly doubles performance.

Note that implementing these improvements required extensive refactoring of the code model. As a result, we may have destabilized some use cases that were not covered by any tests. Please be careful when updating to 2025.0 (i.e., don't do it in a rush), and don't hesitate to report any issues.

We're looking forward to your feedback.

Happy meta-programming with Metalama!

---

## Site navigation

- Index of the whole site: [llms.txt](../llms.txt)

