[Home](../) › [Blog](../blog) › Metalama Status Update, October 2024

# Metalama Status Update, October 2024

> New at PostSharp Technologies in October 2024: Preview builds of PostSharp and Metalama 2025.0 (many improvements), bugfixes, community, and articles.

Published: 2024-10-31 · Author: Gaël Fraiteur · Canonical: https://postsharp.net/blog/metalama-status-update-2024-10

As the .NET Conf 2024 approaches, we've made significant progress in supporting .NET 9.0 and C# 13 with both Metalama and PostSharp. But that's not all. We've also filled usability gaps in introduced types and added several minor features. October was buzzing with community interactions: we hosted an event with Andrea Angella from Productive C#, exchanged blog posts with GoatReview, and published five articles on our own.

## PostSharp 2025.0 Preview

We've been updating PostSharp to the new .NET stack and have now fully caught up with .NET 9.0 RC2.

Additionally, we've worked on the following improvements:

- **Long path support**: Previously available only for .NET Core and .NET Standard projects, long paths are now supported in projects targeting .NET Framework.
- **Improved Windows PDB support**: We've revamped our Windows PDB writer, which now supports modern features like embedded sources or compiler info. This update also fixes bugs and incompatibilities with tools in previously supported features.

We consider ourselves done with PostSharp 2025.0 and plan to announce its general availability in the first week of January.

## Metalama 2025.0 Preview

We've focused on two areas. First, ensuring Metalama is compatible with the latest .NET stack. Second, completing gaps left in the previous version, particularly in support for type introductions. We've also implemented minor improvements requested by the community.

We published the following preview builds: [2025.0.1-preview](https://github.com/orgs/metalama/discussions/371), [2025.0.2-preview](https://github.com/orgs/metalama/discussions/374), [2025.0.3-preview](https://github.com/orgs/metalama/discussions/376), and [2025.0.4-preview](https://github.com/orgs/metalama/discussions/378).

### Platform upgrade

Regarding the platform update, we're now completely done with supporting the upcoming .NET 9 and C# 13. We're only waiting for the official GA release, expected mid November.

- .NET 9.0 RC2 is supported.
- C# 13:
  - [x] Params collections
  - [X] Ref/unsafe in iterators/async
  - [X] Ref struct interfaces
  - [X] Escape character
  - [X] Method group natural type improvements
  - [X] Lock object
  - [X] Implicit indexer access in object initializers
  - [X] Overload resolution priority
  - [X] Partial properties

- Platform deprecation:

    * The minimal supported Visual Studio version is now 2022 17.6 LTSC.
    * The minimal supported Roslyn version is now 4.4.0.

* Third-party package dependencies have been updated.

### Source generators and interceptors

We now consistently execute source generators _after_ any Metalama transformation. Previously, code generators were executed _before_ Metalama at build time, causing inconsistencies with the design time experience, as Metalama would not "see" the output of source generators.

The benefit for you is that aspects can introduce code that relies on the [GeneratedRegex](https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-source-generators) attribute to use build-time-generated regular expressions.

The second benefit is that you can now use Roslyn interceptors side-by-side with Metalama since they no longer conflict with our code transformations.

### Filling code model gaps

You can now use introduced types in any type construction. For instance, if `Foo` is your introduced type, you can create a field or parameter of type `Foo<int>`, `Foo[]`, `List<Foo>`, or `Foo*`. This required a major refactoring of our code model.

You can also implement generic interfaces bound to a type parameter of the target type. For instance, you can now build an `Equatable` aspect that generates code for the `IEquatable<T>` interface, even for introduced types.

### Defining local variables

It's now possible to dynamically define local variables with the following new methods:

```cs
// Explicitly typed
meta.DefineLocalVariable( string nameHint, IType type ) : IExpression
meta.DefineLocalVariable( string nameHint, IType type, dynamic? initializerExpression ) : IExpression
meta.DefineLocalVariable( string nameHint, IType type, IExpresson? initializerExpression ) : IExpression
meta.DefineLocalVariable( string nameHint, Type type ) : IExpression
meta.DefineLocalVariable( string nameHint, Type type, dynamic? initializerExpression ) : IExpression
meta.DefineLocalVariable( string nameHint, Type type, IExpression? initializerExpression ) : IExpression

// var typed
meta.DefineLocalVariable( string nameHint, dynamic? initializerExpression ) : IExpression
meta.DefineLocalVariable( string nameHint, IExpresson? initializerExpression ) : IExpression
```

The `nameHint` parameter suggests the desired local variable name, but the actual name will be chosen dynamically by appending a numerical suffix in case of lexical conflicts with other symbols in the scope.

### Clean up of the representation of overridden fields

When you override a field, Metalama turns it into a property. That is, an object of `IField` type _before_ the aspect will be represented as an `IProperty` _after_ the aspect. This usually works well, and most of you likely haven't had to think much about it.

However, the devil is in the details. If you take a reference to a field before the aspect, you will get an `IRef<IField>`. If you resolve the reference after the aspect, you could previously run into a problem because the new `IProperty` could not be cast into an `IField`.

This tricky part of the code model has been redesigned. If you attempt to resolve an `IRef<IField>` reference to an overridden field, you will get an `IField` _shim_ representing what is actually an `IProperty`. However, this object is _not_ navigable through the `INamedType.Fields` properties, but only, as an `IProperty`, through `INamedType.Properties`. You can navigate to the "real" property using the `IField.OverridingProperty` property. The inverse relationship is the `IProperty.OriginalField` property. Also, the `IRef.As<T>()` method is able to convert an overridden `IField` into its overriding `IProperty` and conversely.

### Other small improvements

* Test framework: Added test options `@Repeat(<int>)` and `@RandomSeed(<int>)` to help reproduce random issues.
* Code model: `ToDisplayString` and `ToString` implemented for introduced declarations.

## Bugfixing releases

While busy with the 2025.0 versions, we published several bugfixing builds in stable releases:

* Metalama 2024.1: [2024.0.29](https://github.com/orgs/metalama/discussions/369) and [2024.0.30](https://github.com/orgs/metalama/discussions/372).
* Metalama 2024.2: [2024.2.25](https://github.com/orgs/metalama/discussions/367), [2024.2.26](https://github.com/orgs/metalama/discussions/370), [2024.2.27](https://github.com/orgs/metalama/discussions/373), [2024.2.28](https://github.com/orgs/metalama/discussions/375), and [2024.2.29](https://github.com/orgs/metalama/discussions/377).

## Community News

### Why did Cyril Canovas switch from Fody to Metalama for caching?

<img src="https://postsharp.net/assets/images/2024/2024-10-goatreview/canovas-c28aed8bde.jpeg" alt="Cyril Canovas" class="portrait" />

[Cyril Canovas](https://www.linkedin.com/in/cyril-canovas-23518147/) is a contributing author at [GoatReview](https://goatreview.com) 🐐, a technical blog focused on sharing in-depth developer experiences and best practices in .NET development.

A few months ago, Cyril [explored Fody as a solution to generate the caching boilerplate](https://goatreview.com/master-aspect-oriented-programming-with-fody-weaving/). That was before he discovered Metalama. Yesterday, Cyril published an article on our blog explaining [why he prefers Metalama over Fody](https://postsharp.net/blog/why-switch-from-fody) to handle his caching boilerplate.

On the flip side, we published a two-part series introducing Metalama to GoatReview readers:
- Part 1: [Avoid repetitive code with Metalama](https://goatreview.com/generating-repetitive-code-with-metalama/)
- Part 2: [Verifying code against architecture with Metalama](https://goatreview.com/verifying-code-against-architecture-with-metalama/)

### Presenting Metalama to the Productive C# community

<img src="https://postsharp.net/assets/images/2024/2024-10-status/andrea-9f63ffe527.jpeg" alt="Andrea Angella" class="portrait">

This month, I had the honor of presenting Metalama to the members of the Productive C# community, a group of developers striving to become better C# developers under the expert leadership of former six-time Microsoft MVP [Andrea Angella](https://www.linkedin.com/in/andreaangella). If you're struggling to keep up with the ever-increasing flow of C# features, check out his free course on [Modern C#](https://www.productivecsharp.com/modern-csharp/).

My presentation had two parts. The first part was public and demonstrated the principal Metalama features. The second part, exclusive to [premium members](https://www.productivecsharp.com/membership), opened the hood and explained how Metalama works and how it integrates with Roslyn.

You can watch the first part on Productive C#'s [YouTube channel](https://www.youtube.com/watch?v=x7IZ2skLYoQ).

## Five published articles

Following a quieter end of summer, we're back in full swing, publishing articles in our _Timeless .NET Engineer_ series. This month, we focused on `INotifyPropertyChanged` and the `Builder` pattern. True llamas will notice that we publish articles in pairs: one Metalama-oriented and the other general. Big thanks to [Darío Macchi](https://dariomac.com/) for his invaluable help in creating the content.

<div class="article-thumbnails">

 <a href="https://postsharp.net/blog/inotifypropertychanged">
      <img src="https://postsharp.net/assets/images/2024/2024-10-10-x-ways-inpc/inpc-dark-84dd2c795f.svg" alt="4 Ways to Implement INotifyPropertyChanged"/>
  </a>

  <a href="https://postsharp.net/blog/inotifypropertychanged-metalama">
      <img src="https://postsharp.net/assets/images/2024/2024-10-15-inpc/inpc-dark-6816311c01.svg" alt="Implement INotifyPropertyChanged with Metalama"/>
  </a>

 <a href="https://postsharp.net/blog/builder-pattern">
      <img src="https://postsharp.net/assets/images/2024/2024-10-builder-2/builder-dark-9ab86b4d4f.svg" alt="The Builder Pattern in C# [2024]"/>
  </a>

 <a href="https://postsharp.net/blog/builder-pattern-with-metalama">
      <img src="https://postsharp.net/assets/images/2024/2024-10-builder-1/builder-dark-ef9a7a3484.svg" alt="Implementing the Builder pattern with Metalama"/>
  </a>

 <a href="https://postsharp.net/blog/why-switch-from-fody">
      <img src="https://postsharp.net/assets/images/2024/2024-10-goatreview/caching-d19424ee55.svg" alt="Why I switched from Fody to Metalama for method caching"/>
  </a>

</div>

## Summary

We've achieved most of the features we set out for Metalama and PostSharp 2025.0, and are now focusing on testing and stabilization. We're confident we'll be ready for the .NET Conf event in November when the General Availability of .NET 9 is expected to be announced. Additionally, we've made strides in bridging the remaining gaps between Metalama and "bare metal" Roslyn generators.

Happy meta-programming!

-gael

---

## Site navigation

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

