Announcing PostSharp 2.0 RTW

by Gael Fraiteur on 06 Jul 2010

I am pleased to announce the final release of PostSharp 2.0.

This release occurs almost one year after the initial prototype of PostSharp 2.0, and 9 months after the first public CTP. Since then, the number of monthly downloads of PostSharp 2.0 has largely exceeded the one of PostSharp 1.5. PostSharp 2.0 is already being used by dozens of commercial customers and all issues reported during the pre-release period have been addressed. Therefore, it’s with great confidence that I recommend everyone makes the upgrade from any previous version of PostSharp, including 1.5 and 1.0.

Why Upgrading from PostSharp 1.5?

PostSharp 1.0 and 1.5 made aspect-oriented programming (AOP) popular in the .NET community.

PostSharp 2.0 makes it mainstream by enhancing convenience (Visual Studio Extension), reliability (dependency enforcement), run-time performance (optimizer), and features (composite aspects, property- and event-level aspects).

New features of PostSharp 2.0 over 1.5 include:

  • Visual Studio Extension – for easier code reading
  • Composite Aspects (Advices and Pointcuts) – for more powerful aspects
  • Adaptive Code Generation – for better runtime performance
  • Aspect Dependencies – to prevent conflicts between aspects in large projects
  • Interception Aspects for Fields, Properties, and Events
  • Instance-Scoped Aspects
  • Build-Time Performance Improvements

For a detailed list of these features, see What’s New in PostSharp 2.0.

How To Upgrade from 1.5?

PostSharp 2.0 contains a library called PostSharp.Laos.dll. This is an emulation layer, and is meant to be used during the migration of 1.5 to 2.0. When you’ll build your project, you’ll get a lot of obsolescence warnings. When all these warnings are gone, you can remove the PostSharp.Laos.dll reference from your project. It’s only after complete migration that you will see improvements in runtime performance.

What’s New Since RC2?

The following issues were fixed:

  • Invalid code generation when two MethodInterceptionAspects are applied on a method containing an anonymous method.
  • Invalid code generation for pointer types ('valuetype' or 'class' keyword missing)
  • Invalid code generation when an interception aspect is applied to a method containing a '.constrained' prefix
  • Invalid code generation when multiple MethodInterceptionAspects are applied to a generic method
  • When a method-level aspect is applied to an interface, it is not multicast to interface methods
  • ILASM failure with symbol sequence points with a document but without a column
  • KeyNotFoundException from MulticastAttributeTask.ImportCustomAttribute

A small breaking change was introduced to solve some well-definedness issue with aspects applied on abstract methods: when applying an aspect to a type or member defined outside the current project, use:

  • MulticastAttribute.AttributeTargetExternalTypeAttributes instead of MulticastAttribute.AttributeTargetTypeAttributes
  • MulticastAttribute.AttributeTargetExternalMemberAttributes instead of MulticastAttribute.AttributeTargetMemberAttributes

Summary

I would like to express special thanks to all people who helped during the pre-release period and to all companies who acquired licenses before the product was labeled as stable. I highly appreciate your support, and have a great confidence in the future of PostSharp and SharpCrafters.

Where to go next from here is not yet decided, but we’ll be working quite soon on a minor release. Most importantly, we’ll start real marketing and we’ll scale the company by hiring the best developers we can find.

Happy PostSharping!