Metalama 2026.1 Generally Available: First LTS Release, Complete C# 14 Support, and a Redesigned Redis Backend

by Gael Fraiteur on 03 Jun 2026

Metalama 2026.1 is now generally available, and it’s our first long-term support (LTS) release. This is a consolidation release: we finished the C# 14 work we started in 2026.0, extended the advising API, redesigned the Redis caching backend, cut several third-party dependencies, and closed most of the bug backlog.

The packages are on NuGet.org, and the Visual Studio extension is on the Visual Studio Marketplace.

For the complete list of changes, see the release notes.

Complete C# 14 support in aspects

In 2026.0 we supported all C# 14 features in your own code but left a few gaps in aspects. Those gaps are now closed:

  • Introducing extension blocks. The new IntroduceExtensionBlock advice lets aspects add extension blocks to static classes. See Introducing types.
  • Contracts on extension-block receiver parameters. You can now add a contract to the receiver parameter of an extension block, and it propagates across the extension members.
  • Introducing user-defined compound assignment operators. Operators such as +=, -=, and *= can now be introduced through IntroduceMethod.
  • Run-time invoker interfaces for extension members.
  • Introducing parameters into partial constructors.

Two C# 14 constructs remain unsupported inside templates: null-conditional assignments (x?.P = v) and the field keyword. Rather than fail confusingly, Metalama now detects them and reports a clear diagnostic (LAMA0101).

Initialization advice

We’ve extended the initialization advice with two new initializer kinds and better support for records:

  • AfterLastInstanceConstructor injects code into a protected virtual OnConstructed method, so it runs once after the most-derived constructor completes.
  • AfterObjectInitializer runs after the constructor and any object initializer or with expression have completed. Metalama makes the target implement IInitializable and rewrites the call sites accordingly, so you can validate or compute derived state once every property has been set.
  • BeforeInstanceConstructor now works on positional records with primary constructors.
  • Constructor parameter introduction can now generate forwarding overloads, so you can add a parameter without breaking binary compatibility.

Dependency injection

IntroduceParameterAndPull now accepts a reuseExistingParameterOfCompatibleType argument. When a chained constructor already accepts a parameter of the same or a more specific type, the existing parameter is forwarded instead of duplicated. The default .NET DI adapter relies on this: an aspect that pulls an ILogger<T> no longer adds a second ILogger<T> parameter when the target constructor already has one. See Injecting dependencies into aspects.

Redesigned Redis caching backend

Metalama.Patterns.Caching.Backends.Redis received a major overhaul, porting the work we did for PostSharp 2025.1 (see Breaking Update of PostSharp Caching adapter for Redis in 2025.1):

  • New data schema. Reading a cache item is now a single, observationally-consistent operation, and cache keys are versioned.
  • Cluster support. Hash tags keep related keys on the same shard, and you can configure ReadCommandFlags and WriteCommandFlags for multi-node setups.
  • Retry and exception-handling policies. The new IRetryPolicy and IExceptionHandlingPolicy interfaces give you exponential backoff and centralized error handling.
  • Key compression. Keys longer than a configurable threshold (128 characters by default) are hashed automatically with XxHash64 or XxHash128.
  • Overload detection. The IsBackgroundTaskQueueOverloaded property lets you back off under pressure, and the dependency garbage collector pauses itself when the queue is saturated.

If you use the Redis backend, note that the schema change requires purging the cache (FLUSHDB) on upgrade. See the breaking changes below.

Fewer third-party dependencies

We reduced our dependency surface to improve supply-chain safety:

  • System.Text.Json replaces Newtonsoft.Json.
  • System.IO.Hashing replaces K4os.Hash (the xxHash implementation now comes from the .NET runtime).
  • Diff-tool integration moved to the optional Metalama.Extensions.DiffEngine package, and HTML test output moved to Metalama.Extensions.HtmlWriter (both used in aspect snapshot testing).
  • We no longer use MD5 for non-cryptographic hashing.

Performance improvements

This release improves both build-time and design-time performance. At build time, configuration files now use System.Text.Json source generators, polymorphic pattern matching in the code model was restructured to match on DeclarationKind or TypeKind, and the WPF temporary compilation phase (MarkupCompilePass1) runs a reduced pipeline that emits member signatures only and skips the linker step. At design time, the protocol between the analyzer and the design-time services moved from JSON to MessagePack.

Bug fixes

We fixed over 100 bugs in this release, spanning the template engine, linker, code model, design-time services, dependency injection, and diagnostics. Metalama 2026.1 is the first release ever to ship with (almost) zero known bugs.

Breaking changes

A few changes may affect existing code:

  • AddInitializer ordering now respects AspectOrderDirection.RunTime.
  • IntroduceParameter on a record primary constructor no longer materializes the parameter by default; opt in with materializeOnRecord.
  • IConstructor.InitializerKind returns Base (instead of None) for an implicit base() call.
  • IEvent.RaiseMethod returns null for non-raisable events—use IEventInvoker.CanRaise.
  • The test base classes AspectTestClass, DefaultAspectTestClass, CurrentDirectoryAttribute, and CurrentProjectAttribute were removed.
  • For the Redis backend: the schema redesign requires a cache purge, ExceptionHandlingCachingBackendEnhancer was removed in favor of the ExceptionHandlingPolicy property, and TransactionMaxRetries and CacheCleanupOptions.Sequential are obsolete.

See the release notes for the full list.

What’s next

As our first LTS release, 2026.1 is the version to standardize on if you want stability. The next feature release is expected to be 2027.0, with support for .NET 11. Work will start in late August, and we don’t expect any larger work on Metalama in the meantime.

Found an issue or have a feature request? Let us know on GitHub.

Happy meta-programming!

-gael