3 ms·
There is also a new compiler feature, "interceptors" that swaps in calls at compile-time. https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12#i
by SideburnsOfDoom 3y ago
There is also a new compiler feature, "interceptors" that swaps in calls at compile-time. https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12#interceptors https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/cs...
This looks very hard to use well, but that's because "it's not for you" to use directly in app code, rather it's a low-level building block for such AOT and code generation patterns and toolkits.
- gfraiteur 3y agoAgreed. Roslyn analyzers, code generators, refactoring providers and other extension points are not designed for application developers but are rather building blocks. We built a code generation and analysis framework based on these Roslyn extension points. It's called Metalama: https://doc.postsharp.net/metalama https://doc.postsharp.net/metalama.
- pjmlp 3y agoI hate it, as it is a bad approach to what should have been a proper AOP framework like PostSharp or Microsoft Fakes. Instead we will end with a special cased mini framework, designed to override reflection code for the purposes of AOT code generation. Something that AOT toolchains for Java have solved much better with agents, PGO and config files. From my point of view, it is neither a good approach to sort that out, nor a good AOP alternative.