Share via


Lack of Aspect Oriented Programming support in .NET

I was preparing for a presentation on Aspect Oriented Programming and I started re-looking for the solutions in .NET.

I'm personally not interested about any of the dynamic methodologies, be it dynamic weaving or any other form of dynamic proxying. To me CLR is static-typed and I'd want any solution to be the same (on DLR I'd definitely accept a dynamic solution). Predictability, performance, debugability are  major concerns that are not well addressed in dynamic methodologies. Some of the Dynamic approaches also have special requirements like they can only support virtual methods as join-points.

To me the perfect AOP solution on .NET would either be an IL weaver which ships as a post-compilation tool or an extension language. AspectDNG and EOS are good example for the two approaches respectively.

Wikipedia had a bunch of links and I tried couple of them. It seemed like most of the tools uses dynamic approaches and had the same issues mentioned above. From the static tools I tried AspectDNG's IL weaver. Even though the weaving was good it didn't update the pdb files resulting in very poor (or no) debugging experience. I tried EOS and liked it a lot. However, the project seemed to have died with no updates for a long time.

I think something serious needs to happen in this space. Either Microsoft or some other large body (serious open source project ?) needs to pick AOP up to make it successful in .NET. To me the tool of choice would be extension to the C# language in the same lines as EOS (or AspectJ).

There seems to be already some work going on like the Policy Injection Application Block which works over .NET remoting.

Cross posted at my personal blog

Comments

  • Anonymous
    November 19, 2007
    PingBack from http://www.bakdevelopment.com/wp/archives/15

  • Anonymous
    November 19, 2007
    Did you check projects such as Windsor? It has interceptors capabilities that makes it much easier to handle this types of things. http://www.ayende.com/Blog/archive/2007/03/07/Building-the-Policy-Injection-in-40-Minutes-with-Windsor.aspx

  • Anonymous
    November 19, 2007
    IMO Interceptors don't work that well. For interceptors to work you need to either change your inheritance tree (so that you inherit from ContextBoundObject) or else some dynamic IL weaving is done which fails in a bunch of scenarios. E.g. only Virtual calls are supported.

  • Anonymous
    November 20, 2007
    Then I fail to understand how you point out the policy injection block as progress. Yes, I would very much like it if the platform has builtin ability for interception. Remoting proxies are close, but we need to remove the requirement for MarshalByRefObject

  • Anonymous
    November 21, 2007
    I said "There seems to be already some work going on like the Policy Injection Application Block which works over .NET remoting." Some work going on doesn't mean that its in the right direction :). To be fair the work is going on in another team which I'd guess doesn't have the ability to change .NET or C# in their own way.

  • Anonymous
    November 30, 2007
    There is a project called "postsharp" that can do AOP for .net. http://www.postsharp.org/