Session

Experimental C# Interceptors: AOT & Performance for free

The just-in-time compiler (JIT) is a mighty beast of the .NET runtime. And it becomes more powerful with every release of .NET. But it comes along with a cost during run-time, when compiling the assemblies containing intermediate language code into machine code. A price we may not pay gladly for highly scalable cloud services. Native AOT, compiling deployments ahead-of-time into executable code, moves this complexity to compile-time. But features that utilize dynamic code emission may stop working.

C# 12.0 - shipped with .NET 8.0 - brings us a new experimental language feature: Interceptors. An interceptor is basically the inverse of a goto statement that enables the Roslyn compiler to replace reflection-based call sites with specialized implementations. Combined with (incremental) source generators, codebases become more trimmable, more Native AOT-friendly and can unlock better performance.

Let's inspect this new concept in detail and see it in action.

Stefan Pölz

Clean C# Coder – Test-driven .NET Developer

Vienna, Austria

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top