PostSharp 4.1 Preview 1 is available for download from our web site and from NuGet as a pre-release package. Note that this is still an early preview, and needless to say PostSharp Tools for Visual Studio 2015 are particularly experimental.
Support for Xamarin
A few years ago, PostSharp had an ambiguous relationship with Mono. Technically, it was possible to run PostSharp on Mono, and there were even a few classes written specifically for this use case. However, we didn’t have any significant testing with Mono. So even if we said we “supported” it, the idea was really just: use PostSharp with Mono at your own risks.
Starting with PostSharp 3, we decided to take the term support more seriously. If we said PostSharp would support a platform, it means that we had automated tests for it, that we would have a development and testing lab, and that we would answer support requests. To support a platform is much more than merely hoping for eventual compatibility. So, we decided to remove Mono support in PostSharp 3. This was not a bad decision; we could not afford another anyway.
But since last week, things are different. Microsoft announced an enhanced partnership with Xamarin to make .NET the most productive development platform for all devices, from wearable to cloud . Through its potential to reduce the size and complexity of .NET code by 20%, PostSharp is a natural fit in this effort to increase developer productivity. Today, we’re announcing that PostSharp 4.1 embraces the cross-platform vision.
Limitations in PostSharp 4.1 Preview 1
This early release is an important milestone but there’s still much work to do:
- We only added support for Xamarin into the PostSharp package, but not to the pattern libraries. That is, you can create your own aspects for Xamarin, but you cannot use the pre-built ones yet. Pattern libraries will be ported in a later release.
- We only support a few Xamarin profiles. More will be supported later.
- You can build only from Visual Studio. The Mac compilation server is supported but your main build machine must be Windows. Mac as a main developer workstation will not be supported in PostSharp 4.1.
Support for Visual Studio 2015
From our point of view, Visual Studio 2015 is the most significant release since Visual Studio 2005, when PostSharp started to integrate with the IDE. We had to rewrite significant portions of our software to take advantage of the new version. The new code is not only simpler, it is also faster and allows for more features and better integration.
When using PostSharp 4.1 with Visual Studio 2015, you will see the following differences:
- Integrate with the light bulb instead of the smart tag. It’s a small difference but it will provide a more consistent experience. Smart tags didn’t scale well with multiple vendors (Microsoft, PostSharp and CodeRush for instance), but the light bulb has been designed for this.
- Real-time detection of some errors. For instance, when making a class recordable or thread-safe, you know in real time that a field must be annotated with [Child] or [Reference].
- Advanced code fixes. When making a class recordable or thread-safe, collection child fields have to be changed from List to AdvisableCollection. There’s now a code fix to do this change automatically, and it even updates field assignments where possible.
What’s Next in PostSharp 4.1?
In the next weeks, we’ll be working on the following improvements:
- PostSharp Threading Pattern Library: support for Windows Phone, Windows Store and Xamarin.
- PostSharp Model Pattern Library: support for Xamarin (Windows Phone and Windows Store are already implemented in 4.0).
- Xamarin: support for all profiles.
- Visual Studio 2015: tuning of the user experience.
You should now see a new release every 3rd week.