PostSharpIntroductionWhat's NewWhat's New in Post­Sharp 3.​1
Open sandboxFocusImprove this doc

What's New in PostSharp 3.1

PostSharp 3.1 builds on the vision of PostSharp 3.0, but makes it more convenient to use. It also catches up with the C# compiler features, and add more flexible licensing options.

Better support for iterator and async methods

When you applied an OnMethodBoundaryAspect to a method that was compiled into a state machine, whether an iterator or an async method, the code generated by PostSharp would not be very useful: the aspect would just be applied to the method that implements the state machine. An OnException advice had no chance to get ever fired.

Starting from PostSharp 3.1, OnMethodBoundaryAspect understands that is being applied to a state machine, and works as you would expect.

Improved configuration system

PostSharp 3.1 makes it easier to share configuration across several projects. For instance, you can now add aspects to all projects of a solution in just a few clicks. This is not just a UI tweak. This scenario has been made possible by significant improvements in the PostSharp configuration system:

  • Support for solution-level configuration files (SolutionName.pssln), and well-known configuration files (postsharp.config) additionally to project-level files (ProjectName.psproj). See Configuring Projects Using postsharp.config for details.

  • Support for conditional configuration elements

  • Support for XPath in expressions (instead of only property references as previously). See Using Expressions in Configuration Files for details.

Build-time performance improvement

PostSharp can now optionally install itself in GAC and generate native images. This decreases build time of a fraction of a second for each project: a substantial gain if you have a lot of projects.

Resolution of file and line of error messages

When previous versions of PostSharp had to report an error or a warning, it would include the name of the type and/or method causing the message, but was unable to determine the file and line number. You can now double-click on an error message in Visual Studio and you’ll get to the relevant location for the error message.

Indentation in logging

For better log readability, PostSharp Logging Pattern Library now automatically indents log entries when entering and exiting methods.

Separate licensing of Pattern Libraries

PostSharp Pattern Libraries can now be purchased separately, so you don't have to buy the full PostSharp Ultimate if you just want to use INotifyPropertyChanged. The licensing system has been modified to support this scenario.