Announcing PostSharp 3.2 Preview 2

by Gael Fraiteur on 30 Jun 2014

We didn’t want to let the first half of this year go without reaching a new milestone, and here it is: we’re excited to announce PostSharp 3.2 Preview 2, available for download on NuGet and our website. PostSharp 3.2 is now fully documented and has made it through the final API review.

We didn’t really know where we were heading to when we started to work on this version, but after a six-month journey we’re very happy of the result.

And here’s our proudest achievement:

PostSharp 3.2 allows you to write thread-safe code in C#. I mean, really. No, we don’t magically make your old C# apps thread-safe, but PostSharp 3.2 both extends and restricts C# to define an execution model that is verifiably thread-safe (we call that threading model). It’s still the C# you know: we extend the language using custom attributes, and we enforce the model using build-time and run-time verifications. So, if you write your code against of one of threading models of PostSharp 3.2, and if you cover your code with reasonable single-threaded tests, you are much more likely to have thread-safe code. Unsafe code would trigger build-time errors or deterministic runtime exceptions instead of allowing for random data races.

We would really like to say that if you use PostSharp you’re 100% sure to have 100% thread-safe code, but this would be absurd. No real-life programming language can claim that. What we do claim is that if you use the custom attributes provided by PostSharp 3.2 instead of writing thread synchronization code manually, you will have a dramatic reliability increase and an equally dramatic cost decrease.

PostSharp 3.2 supports the following threading models: Actor, Immutable, Freezable, Synchronized, Reader-Writer Synchronized, Thread-Affine and (the anti-model) Thread-Unsafe. For more information, read Working with Threading Models.

Object-oriented programming is a great paradigm to build business and consumer applications and we really, really don’t like the blind push for functional programming these days here at PostSharp. There is a word to describe this social phenomena: hype. Fortunately, people in charge for 7-plus-digit projects don’t make their decisions  based on fashions. Although OOP has been criticized for being unpredictable in multi-threaded scenarios, we’re proving that well-understood technologies such as aspect-oriented programming, static analysis and runtime program verification can be used bring thread safety to mainstream programming languages. We still see bright days for OOP.

Although threading models definitively what we’re the most excited about, PostSharp 3.2 brings much more:

  • Aggregatable and Disposable patterns implementing parent/child relationships;
  • Undo/redo through the Recordable pattern
  • 4 new features in PostSharp Aspect Framework: IAdviceProvider, ImportLocationAdviceInstance (these features, combined together, allow to dynamically bind fields/properties of the target class into the aspect class), IAspectRepositoryService, InitializeAspectInstanceAdvice, OnInstanceConstructedAdvice. More blogging required about it.
  • Runtime performance optimization of INotifyPropertyChanged (4x faster).

Happy PostSharping!

-gael