Andre de Cavaignac

Let's blog it out...

PostSharp: A .Net Post Compiler

For several months now, I've been collaborating with Josh Einstein about writing a post compiler for .NET.  Our goal was quite simple:  we wanted to supply the ability to generate code, such as:

  • thorough tracing
  • argument null checks
  • clone implementations
  • dependency properties
  • INotifyPropertyChanged event invocations
  • checking if disposed on each method invocation
  • etc

The job of creating a post compiler to properly handle all of this is not simple, and is quite time consuming, however we figured the benefit to the community would make it well worth it.

At the time I did several searches looking for a solution but could not find any implementation that I found adequate.

Enter PostSharp, a solution conceived and written by a developer named Gael Fraiteur.  Gael has hit the nail on the head, and has implemented an incredibly well documented and functional .net post compiler.  In addition, he goes above and beyond my original expectations, adding attributes that allow for easily intercepting and adding or replacing different types of code.  PostSharp not only makes the aforementioned operations easier, it adds a sense of aspect oriented programming to .NET (thats not as painful as ContextBoundObject).

PostSharp is simple, intuitive, and best of all, comes with a suite of very well commented code samples.  Kudos to Gael for beating me to it!

Leave a Comment

(required) 

(required) 

(optional)

(required)