Announcing PostSharp 2.0 CTP 5

by Gael Fraiteur on 11 May 2010

I am pleased to announce the release of PostSharp 2.0 CTP 5 (build 1199). This is the final CTP, and could have been a release candidate if the documentation were finished. This release is feature-complete and has reached a good level of reliability.

This CTP was silently released last week and updated since two major bugs were quickly discovered. Those who already downloaded a previous revision of this CTP should upgrade now.

What’s New in this CTP?

Support for .NET 4.0 and Visual Studio 2010 RTM

PostSharp 2.0 now supports the final version of .NET 4.0 and Visual Studio 2010.

Support for Windows Phone 7, Silverlight, and Compact Framework

PostSharp 2.0 now supports the following platforms:

  • Microsoft .NET Framework 2.0, 3.0, 3.5, 4.0
  • Microsoft .NET Compact Framework 2.0, 3.5
  • Microsoft Silverlight 3.0, 4.0
  • Microsoft Windows Phone 7 (both Silverlight and XNA),
  • Novell Mono 2.6.

Well read: PostSharp now supports Windows Phone 7!

Support for serialization

Aspects are now correctly initialized when an object is deserialized by the old good BinaryFormatter or by WCF formatters.

Access from user code to binding classes

This release has a somewhat cleaner code generation, and aspects now have direct access to binding classes created by PostSharp. Binding classes allow you to invoke the next node in the chain of invocation even outside the lifetime of an advice. (This is quite hard core; I’ll document it later.)

Merge from PostSharp 1.5 SP1

This CTP contains all the bug fixes (including regression tests) from PostSharp 1.5 SP1.

46 bug fixes

  • COMException from EnvDTE.Project.get_ConfigurationManager()
  • ArgumentException when getting EnvDTE.ActiveConfiguration from ProjectWatcher.UpdateSymbolPath
  • NullReferenceException in QuickInfoTracker.OnMouseMove
  • InvalidCastException in CSharpLanguageAdapter.VisitPropertyAccessor
  • Disable logging in release build.
  • Should raise a warning when an aspects has a serialized field of type FieldInfo
  • When an OnMethodInvocation aspect is applied on a non-const method of a struct, modifications are lost
  • Make it possible to add aspects to unmanaged (native) methods
  • Exception: The located assembly's manifest definition does not match the assembly reference
  • Tracing of DotNet20Platform.GetSymbolReader must be improved
  • Issues when assemblies to be processed are located in the GAC
  • "An item with the same key has already been added" thrown from ModuleDeclaration.WriteILDefinition
  • Support for ASP.NET is broken
  • Build processed stopped in unattented sessions because of the tray icon
  • Licensing component throws System.ArgumentException
  • TypeLevelAspect.RuntimeInitialize is not invoked
  • Bug in the example NotifyPropertyChanged
  • Clueless error when trying to apply an interception aspect to an abstract method
  • MulticastAttributeTask ignores attributes of properties
  • Advice Analyzer throws a NullReferenceException when the method to be analyzed is abstract
  • ArgumentOutOfRangeException in LayerRanker.GetRank
  • NullReferenceException in PostSharp.VisualStudio.VsPackage.BeginInvoke
  • InvalidOperationException in CodeElementVisitor.GetEnhancedCodeElement
  • Integration problem with Resharper: Resharper removes PostSharp QuickInfo content
  • Static constructor of the MSBuild task may crash when hosted in Visual Studio
  • It should be forbidden to add instance-scoped aspects on a value type
  • MethodPointcutEngine throws "ArgumentException: You have required a generic definition, but you have passed a generic instance."
  • Add property LocationInterceptionArgs.LocationName
  • Refactor HandlerProviderTransformation and other mechanisms behind advices/pointcuts.
  • The CLR host should not automatically consider an assembly as CLR-loaded if it's in GAC
  • Win32Exception in PostSharp.VisualStudio.HWndDispatcher.BeginInvoke
  • DocumentInfo.GetDocumentInfo should return null when the document is not C#
  • COMException thrown by EnvDTE.CodeElements.GetEnumerator
  • Emit a performance warning when PostSharp is executed on an assembly without aspects
  • Conflict when the same user opens a privileged and non-privileged pipe server
  • Invalid serialization of type values into custom attributes member: assembly name missing
  • Multicast inheritance does not work when a type inherits a generic interface defined in a different assembly
  • Adornment layer not displayed in Visual Studio 2010 RTM
  • Native host: aspects can't call Assembly.Load with a partial name
  • Install the license key directly in registry
  • PostSharp removed from Custom.After.Microsoft.Common.targets during upgrades
  • VsPackage.GetServiceFromBackgroundThread throws InvalidCastException
  • Attempt to use two adornment layers when symbol file is updated
  • Licensing UI should close pipe servers automatically
    License or exception dialog box may cause MSBuild to hung
  • Methods GetUniqueName may cause infinite loop


As I said, this is the last CTP. I am quite confident in the quality of this release, but it still needs to be tested by the community. The reason is that I can’t think about all the possible situations and combinations (I can only test what I expect). I am generally able to fix a bug within 1-2 days if I can reproduce it, so you don’t have to be afraid.

I’ll now spend most of my time in writing the conceptual documentation. I’ll upload frequent updates on The offline documentation is currently unavailable while work is in progress.

If everything goes right (as I expect), the first release candidate will available early June and the RTW may be released late June, depending on the feedback of the RC.

Happy PostSharping!