A Roslyn-based framework for code transformation and aspect-oriented programming #50752
Unanswered
gfraiteur
asked this question in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
(This is a cross post from the C# Language forum.)
I thought it might be interesting to the Roslyn community (if not please feel free to delete) to know that we at PostSharp have been working on Project "Caravela", an extension of Roslyn that adds support for code transformation and aspect-oriented programming.
Please note this is a very early preview of a closed-source project that is not being offered for sale at the moment. I'm reaching out with hope to get feedback and to say we're becoming extenders of Roslyn.
The current preview is a build-time experience only, we intend to integrate with the source generator API for a better design-time experience.
Our approach allows to write aspects (or code templates) in pure C# without referencing the Roslyn API, and without resorting to StringBuilder. We also have a low-level API that opens Roslyn in writing, and should replace different MSIL transformation stacks. We have examples to show how to complete CancellationToken or ConfigureAwaitable.
Here is the traditional simplest logging example using our high-level API:
▶ Try in your browser
Let's apply the
[Log]
aspect to the following method:The following method gets actually compiled instead of your source code:
If you're interested, don't hesitate to reach out directly or on https://github.com/postsharp/Caravela.
Beta Was this translation helpful? Give feedback.
All reactions