Navigation


contactdonateaop.net



PostSharp Article Available for National Publication

posted by gael    Friday, July 25th, 2008 at 3:58 pm

I have an article available for publication for national audiences only. This means that the article should either be translated into a local language (anything but English), either distributed to a closed community (subscribers only).

If anyone is interested, please contact me. And if you want your favorite magazine to publish something about PostSharp, forward them this page :-D.

-Gael

P.S. The article is great!

PostSharp and ILMerge [Solved?]

posted by gael    Friday, July 25th, 2008 at 11:24 am

In my previous post I claimed that it was not possible, in general, to merge assemblies enhanced by PostSharp, because it would break the assembly references stored as strings in aspect serialization data.

I did not realize that the BinaryFormatter provides a way to solve our problem. It is indeed possible to provide its own SerializationBinder, whose role is precisely to return the System.Type corresponding to an assembly name and a type name. We can provide a custom binder to redirect merged assemblies.

This is the feature I have added to build 1.0.10.411 available for download in the builds section; I could still do it in 1.0 since it is a no-risk feature, breaking nothing existing (if you don’t use it, nothing can go wrong).

I have added a new class PostSharp.Laos.LaosSerializationBinder. You can set the static property Current to your own implementation of SerializationBinder. If you don’t set it, nothing is changed. The LaosSerializationBinder class it itself derived from SerializationBinder and implements the feature we need: assembly retargeting. So all you have to do is to create an instance of this class, set up retargeting policies, and assign it to LaosSerializationBinder.Current.

The following code sets up PostSharp Laos so that references to ‘MergedPostSharpLib.dll’ are retargeted to ‘MergedPostSharp.exe’ (supposing that the library has been merged into the executable):

LaosSerializationBinder binder = new LaosSerializationBinder();
binder.Retarget("MergedPostSharpLib", "MergedPostSharp");
LaosSerializationBinder.Current = binder;

The only thing you have to really take care about is to set up the binder before the first aspect is deserialized. Aspect deserialization is triggered from static constructors of enhanced classes, so you may need to initialize the weaver very soon, and eventually to refactor your "Main(string args[])" method.

Apart from that, it should work very well.

Happy PostSharping!

~Gael

PostSharp and ILMerge

posted by gael    Thursday, July 24th, 2008 at 9:40 am

Combining PostSharp with ILMerge seems a recurring demand. Indeed, many developers don’t welcome the multiplication of dependent assemblies as PostSharp.Public.dll and PostSharp.Laos.dll, and ILMerge seems the dreamed solution to that. Unfortunately, it will work only in rare cases.

The Simple Case

Say you have an assembly named MyProgram.exe with aspects defined in this assembly. The application is formed of the following assemblies:

PostSharp.Public.dll
PostSharp.Laos.dll
MyProgram.exe

In this particular case, it is valid to merge all three assemblies into a new assembly equally named MyProgram.exe.

However, if you modify the name of the merged assembly, it will cease to work.

What’s Wrong?

Remember that the aspects are serialized into the assembly. It uses the BinaryFormatter to do the job. Unfortunately for our purpose, this formatter stores the full type name of aspects, including the assembly name. So when you rename the assembly, you break the link between the aspect serialization and the underlying types, and you get an exception during deserialization.

The same occurs when you have aspects in one of the dependencies you merge. Say your program references MyLibrary.dll, whose some classes have been enhanced by PostSharp Laos. If you merge it into MyProgram.exe, the serialization of aspects previously defined in MyLibrary.dll will be broken.

Possible Solution

The problem clearly lays in the use of the BinaryFormatter to do the job. We could eventually use another serializer that does not store the full type name.

This feature (pluggable serializers) was actually present in former builds of what is now PostSharp 1.5, but I have removed the feature because it became useless. If there is some interest, I could restore it. It very much depends on the feedback I will get.

How is this a critical feature for you?

 

Happy PostSharping,

~Gael

Announcing PostSharp 1.5 CTP 1

posted by gael    Wednesday, July 23rd, 2008 at 5:25 pm

Now that PostSharp 1.0 is pretty stable and anyway virtually frozen, I am pleased to announce that the first community technical preview of PostSharp 1.5, the current living branch of PostSharp, is now available for download.

This CTP makes a great leap forward in supporting more platforms:

  • Novell Mono. PostSharp now run on Mono and has been tested both in the Windows and the Linux implementation. PostSharp is now truly cross-platform, since the same PostSharp executable can now run on any platform.
  • Microsoft Silverlight 2. Who said aspects are only for server applications? Thanks to PostSharp 1.5, you can now apply aspects to your projects targeting Silverlight 2.
  • Microsoft .NET Compact Framework 2.0.

Enlarging PostSharp support to these platforms required the possibility to read and transform assemblies without loading them in the CLR. Therefore, one of the hidden new features of PostSharp 1.5 is the ability to read assemblies directly from disk.

Another hidden feature is the support for assembly retargeting, which happens when an assembly reference is resolved to an assembly of higher version than was required. This feature, supported by the .NET framework, was missing in PostSharp. This first CTP offers a first yet incomplete solution to this issue.

The documentation and samples have been updated to include support for Silverlight and the Compact Framework.

Note that PostSharp 1.5 is not fully compatible with PostSharp 1.0. End-users should not see the difference, but if you played with PostSharp Core or with some advanced features of PostSharp Laos, your code will need some changes.

Happy PostSharping!

~Gael

The Near Future of PostSharp

posted by gael    Tuesday, July 22nd, 2008 at 1:07 pm

PostSharp 1.0

Most people think of PostSharp as a new product, but PostSharp is actually near to 4 years old. The first bits were indeed developed in September 2004. It took roughly 2 years to develop the product and 2 years to stabilize days. Attentive users have maybe noticed the last RC of PostSharp has the full version number 1.0.10.403. 10 means that it is the 10th release of the 1.0 branch. 403 is the revision number of the root of that branch in source control.

Today the 1.0 branch is very stable. There has been no major change and so significant feature addition for one year. It is being downloaded more than one thousand times per month (still quite a modest number). So the future of the 1.0 branch is clear: fix bugs and declare the branch stable. More a marketing operation than a technical one.

The 1.0 branch will remain a legacy one. Bugs will continue to be fixed, support will be provided. So it is definitively a product you can rely on.

PostSharp 1.5

In October 2007, I forked the 1.0 branch into 1.1. Unfortunately, I had to interrupt the work, principally because much work was still required on 1.0, and on the web site. Good news is that I resumed work around last April and made good progresses.

Since this new branch contains major new features, I chose to number it 1.5.

The objectives of this branch are triple:

  1. Enlarge supported platforms to Mono, Compact Framework and Silverlight 2 [CTP 1, July 2008].
  2. Implement frequently asked feature [CPT 2, August-Sep 2008]
  3. Allow aspects to be inherited (for instance, if you apply an aspect on an interface, the aspect will be applied to all types implementing it) [CPT 3, Sep-Oct 2008].

After the cycles of CTP, there will be a cycle of Beta releases during which features will be added according to the feedback got during CTP. Then release candidates and hopefully RTM.

A characteristic of 1.5 is that it won’t be fully compatible with 1.0. End users (those writing aspects using PostSharp Laos) should not see a big difference and most of their existing code should still work, but some minor changes are to be expected for Core developers. Not a big deal, but it’s better to know it.

Design by Contract

PostSharp 1.5 will provide the basic bricks necessary to build a real design-by-contract (tm, I know) framework. I still don’t know exactly what it will contain, but you can obviously expect the non-nullable references and similar value constraints, including a mean to do your own validators without the burden of PostSharp Laos. But the framework should be more ambitious than just value checking. Invariant checks and defense (eventually in a multithreaded context) are on the wish list.

A first version will be available in November 2008.

I have no plan for 2009, but I guess it will be determined by your feedback on these new features.

Happy PostSharping!

~Gael

PostSharp @ Prio Architecture Conference, Baden-Baden, Germany

posted by gael    Monday, July 21st, 2008 at 2:57 pm

I am delighted to announce that I will present PostSharp (officially, aspect-oriented programming and design by contract) in Baden-Baden, Germany, on November 11, 2008 at the prio.conference 2008 Home Page, dedicated to software architecture.

Germany is already the country where PostSharp is arguably the most popular, certainly because of the influence of the early enthusiast Ralf Westphal.

Why design by contract, you may ask? Well, you’ll discover it soon on this blog…

Announcing PostSharp 1.0 RC 4

posted by gael    Monday, July 21st, 2008 at 11:11 am

The last release candidate was unfortunately not the final one. Last Friday I silently released a new candidate, and since there seems to be no obvious error, it’s not time to announce it (I had to retract a previous tentative to public RC4 for this reason).

This new RC corrects fourteen issues, two of them required non-trivial changes requiring a new RC.

Maybe the best news for all is that it is now possible to apply multiple OnMethodInvocation aspects on a single method, at least with target-site weaving. I have been shamefully so far too lazy to reconsider a limitation that no longer any rationale.

I was however quite satisfy to notice that most bugs had pretty small coverage, so I consider already the product as very stable.

Unless you guys come with a new high-coverage bug requiring non-trivial refactoring, this will be the final release candidate.

Happy PostSharping!

~Gael

Dependency Injection Killed by Simon Ince

posted by gael    Tuesday, July 1st, 2008 at 9:05 am

Dependency Injection is Dead! is the somewhat provocative title of an interesting post of Simon Ince.

Simon indeed proposes another approach: AOP-powered Dependency Resolution. The idea is to use aspects on fields or properties to resolve the dependencies on-demand, when the property or field value is retrieved. Technically, it would be enough to turn the old good [Dependency] custom attribute into an aspect.

I won’t copy-paste Simon’s stuff, so please read from the horse’s feather on his blog.

A refreshing view on a topic that tends to become sanctified and therefore unchallenged in our community.

Even if this approach does not solve all the use cases of Dependency Injection, covers a lot of them in quite an elegant way. While it would be theoretically easy to use this approach with dependency injection frameworks (because dependency resolution is obviously one the major components of a DI framework, the other big one being the object builder), I noticed that Unity does not offer the functionality at the required level of granularity. A pity, which I have notified in illo tempore to the Unity team. Maybe some day wind will turn…

Happy PostSharping!

-Gael

Download Adobe InDesign CS2 v4.0 OEM Cheap OEM Software. Buy and download oem Adobe, oem Autodesk, oem Macromedia, oem Microsoft at SoftwareVending.com Download Adobe Acrobat 7.0 Pro OEMDownload Adobe Contribute CS3 OEM Online Casinogulfstream casino hollywood gun lake casino updated information hammond indiana casino hampton beach casino hampton nh Download Microsoft Windows Millennium Edition OEMDownload Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEM Download Adobe Acrobat 3D OEM Download Adobe Photoshop CS3 French OEMDownload Adobe Dreamweaver CS3 OEM Download Adobe Acrobat 6 professional OEM Download Adobe Premiere Elements 3.0 OEMDownload Adobe Premiere Pro 7 OEM Download Adobe Acrobat 7.0 Pro OEM Download Adobe Streamline 4.0 OEMDownload Adobe Contribute CS3 OEM Download Adobe Acrobat 8 OEM Download Microsoft Windows XP Professional SP2 OEMDownload Adobe InDesign CS2 v4.0 OEM Download Adobe Acrobat Distiller 6 OEM Download Adobe Acrobat 7.0 Pro OEMDownload Adobe Acrobat 6 professional OEM Download Adobe After Effects 7 OEM Download Adobe Type Manager Deluxe 4.1 OEMDownload Adobe Photoshop CS3 French OEM Download Adobe After Effects CS3 OEM Download Microsoft Windows Server 2008 OEMDownload Adobe Acrobat 3D OEM Download Adobe Atmosphere 1.0 OEM Download Adobe Photoshop CS2 + Image ready CS2 OEMDownload Adobe InDesign CS2 v4.0 OEM Download Adobe Audition 1.5 OEM Download Adobe Creative Suite 3 Design Premium OEMDownload Microsoft Windows Millennium Edition OEM Download Adobe Contribute CS3 OEM Download Adobe Contribute CS3 OEMDownload Adobe Illustrator CS OEM Download Adobe Creative Suite 2 Premium OEM Download Adobe InCopy CS OEMDownload Adobe Premiere PRO 2.0 OEM Download Adobe Creative Suite 3 Web Premium OEM Download Adobe Creative Suite 3 Design Premium OEMDownload Adobe Acrobat 7.0 Pro OEM Download Adobe Creative Suite 3 Design Premium OEM Download Adobe Pagemaker 7 OEMDownload Adobe Illustrator CS3 OEM Download Adobe Creative Suite Standard Full OEM Download Adobe Premiere Pro 7 OEMDownload Adobe Photoshop Lightroom 1.3 Multilingual OEM Download Adobe Dimensions 3.0 OEM Download Adobe Dreamweaver CS3 OEMDownload Adobe Creative Suite 3 Design Premium OEM Download Adobe Dreamweaver CS3 OEM Download Adobe Photoshop CS + Adobe ImageReady CS OEMDownload Adobe Photoshop Lightroom 1.3 OEM Download Adobe Encore DVD 1.5 OEM Download Microsoft Windows XP Professional x64 OEMDownload Adobe Contribute CS3 OEM Download Adobe Fireworks CS3 OEM Download Adobe InCopy CS OEMDownload Adobe Photoshop CS + Adobe ImageReady CS OEM Download Adobe Flash CS3 Professional OEM Download Adobe Creative Suite Standard Full OEMDownload Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEM Download Adobe Flex 2 OEM Download Adobe Creative Suite 3 Web Premium OEMDownload Adobe GoLive CS2 V 8.0 OEM Download Adobe Flex Builder Professional 3.0 OEM Download Microsoft Windows Server 2008 OEMDownload Adobe Premiere Elements 1.0 OEM Download Adobe FrameMaker 7.0 OEM Download Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEMCheap OEM Software. Buy and download oem Adobe, oem Autodesk, oem Macromedia, oem Microsoft at SoftwareVending.com Download Adobe GoLive CS V 7.0 PC OEM Download Adobe Creative Suite Standard Full OEMDownload Adobe InCopy CS OEM Download Adobe GoLive CS2 V 8.0 OEM Download Microsoft Windows XP Professional x64 OEMDownload Adobe Premiere PRO 2.0 OEM Download Adobe Illustrator 10 OEM Download Adobe Acrobat 8 OEMDownload Adobe GoLive CS V 7.0 PC OEM Download Adobe Illustrator CS OEM Download Adobe Creative Suite Standard Full OEMDownload Microsoft Windows Server 2008 OEM Download Adobe Illustrator CS2 OEM Download Adobe Photoshop Elements 5 OEMDownload Adobe Illustrator CS3 OEM Download Adobe Illustrator CS3 OEM Download Adobe Dreamweaver CS3 OEMDownload Adobe Premiere PRO 2.0 OEM Download Adobe InCopy CS OEM Download Adobe Creative Suite Standard Full OEMDownload Adobe Creative Suite 2 Premium OEM Download Adobe InDesign CS OEM Download Adobe Creative Suite 3 Web Premium OEMDownload Adobe Photoshop 7 OEM Download Adobe InDesign CS2 OEM Download Adobe Contribute CS3 OEMDownload Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEM Download Adobe InDesign CS2 v4.0 OEM Download Adobe Acrobat 7.0 Pro OEMDownload Adobe Creative Suite Standard Full OEM Download Adobe Pagemaker 7 OEM Download Adobe Illustrator CS2 OEMDownload Adobe Pagemaker 7 OEM Download Adobe Photoshop 7 OEM Download Adobe Type Manager Deluxe 4.1 OEMDownload Adobe Premiere Pro 7 OEM Download Adobe Photoshop CS + Adobe ImageReady CS OEM Download Adobe GoLive CS2 V 8.0 OEMDownload Adobe FrameMaker 7.0 OEM Download Adobe Photoshop CS2 + Image ready CS2 OEM Download Adobe Photoshop CS3 Extended OEMDownload Adobe Premiere Pro 1.5 OEM Download Adobe Photoshop CS3 Extended OEM Online Casinogulfstream casino hollywood gun lake casino updated information hammond indiana casino hampton beach casino hampton nhDownload Adobe Dimensions 3.0 OEM Download Adobe Photoshop CS3 French OEM Download Adobe InDesign CS2 v4.0 OEMDownload Adobe Photoshop Lightroom 1.3 OEM Download Adobe Photoshop Elements 4.0 OEM Download Adobe Acrobat 7.0 Pro OEMOnline Casinogulfstream casino hollywood gun lake casino updated information hammond indiana casino hampton beach casino hampton nh Download Adobe Photoshop Elements 5 OEM Download Adobe Acrobat 3D OEMDownload Adobe InDesign CS OEM Download Adobe Photoshop Lightroom 1.3 OEM Download Adobe Type Manager Deluxe 4.1 OEMDownload Adobe Streamline 4.0 OEM Download Adobe Photoshop Lightroom 1.3 Multilingual OEM Download Adobe Premiere Pro 7 OEMDownload Adobe Dimensions 3.0 OEM Download Adobe Premiere Elements 1.0 OEM Download Adobe Photoshop CS3 Extended OEMDownload Adobe Photoshop CS + Adobe ImageReady CS OEM Download Adobe Premiere Elements 3.0 OEM Download Microsoft Windows Millennium Edition OEMDownload Adobe Acrobat 6 professional OEM Download Adobe Premiere Pro 1.5 OEM Download Microsoft Windows XP Professional x64 OEMDownload Adobe Photoshop 7 OEM Download Adobe Premiere PRO 2.0 OEM Download Adobe Photoshop CS3 French OEMDownload Adobe Streamline 4.0 OEM Download Adobe Premiere Pro 7 OEM Download Microsoft Windows NT 4.0 Terminal Server OEMDownload Adobe FrameMaker 7.0 OEM Download Adobe RoboHelp 6 OEM Download Adobe Pagemaker 7 OEMDownload Adobe Premiere Elements 1.0 OEM Download Adobe Streamline 4.0 OEM Download Adobe Contribute CS3 OEMDownload Adobe Acrobat 7.0 Pro OEM Download Adobe Type Manager Deluxe 4.1 OEM Download Adobe Acrobat 6 professional OEMDownload Adobe InDesign CS2 OEM Download Microsoft Digital Image Suite 2006 11.0 OEM Online Casinogulfstream casino hollywood gun lake casino updated information hammond indiana casino hampton beach casino hampton nhDownload Adobe RoboHelp 6 OEM Download Microsoft Exchange Server Enterprise 2003 OEM Download Adobe Creative Suite 2 Premium OEMDownload Adobe Creative Suite 2 Premium OEM Download Microsoft Frontpage 2003 OEM Download Adobe GoLive CS V 7.0 PC OEMDownload Adobe InDesign CS2 OEM Download Microsoft Money 2007 Deluxe OEM Download Adobe Photoshop CS3 Extended OEMDownload Adobe Premiere Pro 1.5 OEM Download Microsoft Office 2000 Premium Edition OEM Download Adobe Acrobat 3D OEMDownload Microsoft Windows NT 4.0 Terminal Server OEM Download Microsoft Office 2003 Professional Edition OEM Download Adobe InDesign CS2 OEMDownload Adobe Creative Suite 3 Web Premium OEM Download Microsoft Office 97 SR2 OEM Download Microsoft Windows Server 2003 Enterprise Edition OEMDownload Adobe InDesign CS2 OEM Download Microsoft Office SharePoint Designer 2007 OEM Download Adobe Illustrator CS3 OEMDownload Adobe Premiere PRO 2.0 OEM Download Microsoft Office Visio Professional 2007 OEM Download Adobe Premiere Elements 1.0 OEMCheap OEM Software. Buy and download oem Adobe, oem Autodesk, oem Macromedia, oem Microsoft at SoftwareVending.com Download Microsoft Office XP Professional OEM Download Adobe Illustrator 10 OEMDownload Adobe GoLive CS V 7.0 PC OEM Download Microsoft OneNote 2003 Pro OEM Download Adobe RoboHelp 6 OEMDownload Adobe Photoshop CS3 Extended OEM Download Microsoft PhotoDraw 2.0 OEM Download Adobe FrameMaker 7.0 OEMDownload Adobe Streamline 4.0 OEM Download Microsoft Picture It Photo Premium 9 OEM Download Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEMDownload Adobe Acrobat 8 OEM Download Microsoft Plus! XP OEM Download Adobe Illustrator CS2 OEMDownload Adobe Photoshop 7 OEM Download Microsoft SQL Server 2000 Enterprise Edition OEM Download Adobe Creative Suite 2 Premium OEMDownload Adobe RoboHelp 6 OEM Download Microsoft Streets & Trips 2006 OEM Download Adobe Photoshop Elements 4.0 OEMDownload Adobe Acrobat 7.0 Pro OEM Download Microsoft Streets and Trips 2004 OEM Download Adobe Acrobat 7.0 Pro OEMDownload Adobe Illustrator CS2 OEM Download Microsoft Visio 2003 Pro OEM Download Adobe Photoshop CS2 + Image ready CS2 OEMDownload Adobe Photoshop 7 OEM Download Microsoft Visual Basic 6.0 Pro OEM Download Adobe Dreamweaver CS3 OEMDownload Adobe RoboHelp 6 OEM Download Microsoft Visual Studio Professional Edition 2005 MSDN OEM Download Adobe Premiere Elements 3.0 OEMDownload Adobe Acrobat 6 professional OEM Download Microsoft Windows 2000 Advanced Server with SP4 OEM Download Adobe Illustrator CS OEMDownload Adobe Illustrator 10 OEM Download Microsoft Windows 2000 Professional with SP4 OEM Download Adobe Streamline 4.0 OEMDownload Adobe Photoshop CS3 French OEM Download Microsoft Windows 98 Second Edition OEM Download Adobe InDesign CS2 OEMDownload Adobe Type Manager Deluxe 4.1 OEM Download Microsoft Windows Millennium Edition OEM Download Adobe Acrobat 8 OEMDownload Adobe GoLive CS V 7.0 PC OEM Download Microsoft Windows NT 4.0 Terminal Server OEM Download Adobe Premiere Elements 3.0 OEMDownload Adobe Photoshop CS2 + Image ready CS2 OEM Download Microsoft Windows Server 2003 Enterprise 64 Bit x64 OEM Download Adobe Creative Suite 3 Design Premium OEMDownload Adobe Streamline 4.0 OEM Download Microsoft Windows Server 2003 Enterprise Edition OEM Download Adobe Streamline 4.0 OEMDownload Adobe Acrobat 8 OEM Download Microsoft Windows Server 2008 OEM Download Adobe GoLive CS V 7.0 PC OEMDownload Adobe Illustrator CS OEM Download Microsoft Windows XP Professional SP2 OEM Download Microsoft Windows Server 2003 Enterprise Edition OEMDownload Adobe Photoshop Elements 5 OEM Download Microsoft Windows XP Professional x64 OEM Download Adobe Illustrator CS3 OEMDownload Microsoft Windows NT 4.0 Terminal Server OEM Download Microsoft Works 7 OEM Online Casinogulfstream casino hollywood gun lake casino updated information hammond indiana casino hampton beach casino hampton nh