Postsharp

I was looking for aspect oriented programming (AOP) tools I found an interesting source forge project today: Postsharp. It lets you inject code into an assembly after compilation or at runtime and it is very extensible. Perfect for injecting things like runtime arguments checks, tracing and more.

A while ago there was similar project XC# and it was fun working with it. But apparently it is dead now. It had some problems, too: the compilation time duplicated or triplicated and it was plagued by bugs.

So I wonder whether Postsharp is better. I guess I’ll have to try it out..

Be aware: don’t ever abuse these tools – injecting code can prove very problematic and can cause strange application behavior if you complicate things too much. I would limit myself to check argument values (not null, etc) and perhaps for tracing and/or exception handling at design or test time. IOW don’t try to create just a main method and inject the rest of the code ;-).

And if you want to enter eternal hall of fame, Projectsharp is looking for developers.

Leave a Reply