Archive

We’re excited to announce that PostSharp 3.1 RTM is now available for download from Visual Studio Gallery and NuGet.

Before we even mention the new features, we have good news for those who are just interested in a specific functionality in PostSharp such as logging or INotifyPropertyChanged:

PostSharp Pattern Libraries Available as Stand-Alone Purchases

It is now possible to purchase PostSharp Pattern Libraries separately so you don’t have to buy PostSharp Ultimate if you only need a small part of it. Please check the prices online and let us know if you have any questions.

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 adds more flexible licensing options. You can read more about the new features in the PostSharp 3.1 Preview Announcement. In short, PostSharp 3.1 brings you:

  • faster builds: 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.
  • support for async and iterator 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 advise 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.
  • solution-level policies and 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.
  • locations (file/line) of errors and warnings: 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.
  • automatic indentation in logging: for better log readability, PostSharp Diagnostics Pattern Library now automatically indents log entries when entering and exiting methods.

All customers with an active maintenance subscription can upgrade to PostSharp 3.1 for free.

Happy PostSharping!

-iveta

Many people wonder how many lines of code they really save thanks to PostSharp beyond the buzz and marketing promises. Thanks to data collected through our CEIP program, we are able to shed some light on this question.

When you opt-in for CEIP, we collect a few anonymous metrics for all projects you build. Two of these metrics are interesting here: the number of lines of code (we just count instructions, not declarations like fields, properties, type headers or method headers), and the number of aspect instances in your code.

We feed this data into a database that already has a few GBs. Let’s use R to analyze it.

First, we load the data. We filter out demo or test projects with fewer than 100 lines.

library(RODBC)
db <- odbcConnect("Feedback")
m <- sqlQuery( db, "SELECT InputLines, AspectsInstances 
FROM MetricSample s TABLESAMPLE ( 25 percent )
WHERE AspectsInstances > 0 and InputLines > 100")

We want to know how many aspects per line manual of code we have. The invert metric is easier to represent and interpret, so let’s compute it:

hist( m$InputLines / m$AspectsInstances, xlim=c(0,200), breaks=200000, col="lightblue"  )

Here is the result of this graph:

And here are the summary of this vector:

summary(m$InputLines / m$AspectsInstances)
# Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
# 0.0     12.6     43.8    626.8    199.0 357800.0 

What does it mean?

25% of PostSharp-enabled projects have an aspect every 13th line of code or less. 50% of these projects have an aspect every 44th line of code.

Suppose that each aspect avoids 4 lines of code. This is a pretty pessimistic estimate – an INotifyPropertyChanged aspect can save dozens of lines of code per instance. Also, PostSharp counts a line of code as any location where the debugger can stop, so it usually counts more than lines of text. So, with this ballpark estimate of how much a single aspect instances saves, we can say that:

  • 25% of projects would be 30% larger without PostSharp, i.e. PostSharp saves 23% of development costs.
  • For 50% of projects, the codebase increase without PostSharp would be 9% and the teams saves 8% with PostSharp.

Note that large projects are overrepresented in our sample because CEIP data are uploaded by many team members. However, this bias also reflects the higher economic importance of large projects.

Teams who use PostSharp the best get a 23% cost reduction.

This is pretty amazing in my eyes and I’m proud of us.

Happy PostSharping!

-gael

PostSharp Technologies and Manning Publications prepared a great Christmas surprise for you –
a 20% discount on PostSharp licenses, and a 50% discount on .NET books published by Manning.
That seems a great opportunity to use up your yearly budget!

Get 20% off PostSharp licenses
Purchase any new license of PostSharp Ultimate or PostSharp Professional and save 20% off your order by entering the discount code POSTSHARP13 during checkout. But hurry, the special offer is only valid until December 15th, 2013 - midnight EST.
Get your discount today!

Save 50% on Manning books
We’ve partnered with Manning Publications to bring you the best of .NET books at a great price. Stay tuned for Friday, December 13th and get 50% off the books below on that day using the discount code psdotd14:

  • AOP in .NET
  • C# in Depth
  • Real-World Functional Programming
  • Windows App Store Development: C# and XAML
  • Metaprogramming in .NET
  • ASP.NET MVC 4 in Action
  • ASP.NET in Practice

Register for Manning's Countdown to 2014 to get a special discount every day and
a chance to win a free copy of an eBook, an iPad mini and a PostSharp Ultimate license.

Happy PostSharping!

-iveta