Subscribe to our newsletter for release news and a monthly status report.
You can unsubscribe at any time.
There is a lot of new things to tell today. To make it simpler I will make a post for each of them. Let me start with the first: phased execution.
You probably know that PostSharp projects are composed of tasks. Indexing types is a task, weaving is a task, and even compiling back the code is a task. What you maybe don't know if that tasks are grouped in phase. PostSharp defines four standard phases: load, analyze, transform and generate.
When you execute a single project, i.e. when you transform a single module, the situation is trivial: we execute one phase after the other.
However, when you transform multiple modules in a single invocation of PostSharp, then you have the question: should I analyse all module, then transform them all, then compile them all, or should I process one module completely, then go to the next one.
You have now the choice. PostSharp can do both: the phases and the sequential execution.
I have defined a new property ProjectExecutionOrder on the PostSharpObjectSettings object so you can choose. If you host PostSharp yourself, of course! If you don't, anyway, each invocation of PostSharp processes only one module and this discussion is useless.
But if you do host PostSharp, you have the possibility to execute custom code between phases. If you really need this (and think twice if it cannot be implemented as a normal task), look at the events PhaseExecuting and PhaseExecuted of the PostSharpObject event. How would you get a chance to register your own event handlers? Good question, you have to implement a local host. I explain it in my next post.