PostSharp Conflicting Aspects Warning

I use PostSharp Express in VS2013 to create validation aspects that I can apply to my properties. I followed this PostSharp location hook guide . They all work well, but I get hundreds of warnings:

Conflicting aspects in "MyNamespace.get_MyProperty": conversions ".MyValidation1Attribute: intercepted by OnGetValue, OnSetValue" and "MyNamespace.Validation2Attribute: intercepted OnGetValue, OnSetValue tips" are not strictly commutative. Their order of execution is uncertain.

I think this is the result of my posting of several aspects of checking for the same properties. At first I tried a comma - to separate the attributes, which, as I understand it, should order them: [Validation1,Validation2] , but there were still warnings.

Since my aspects are commutative (no matter what order they are executed), a PostSharp advisor to mark them as such using AspectTypeDependency as follows:

 [AspectTypeDependency(AspectDependencyAction.Commute, typeof(ILocationValidationAspect))] 

However, it appears that the PostSharp.Aspects.Dependencies namespace PostSharp.Aspects.Dependencies not included in the Express license. Is there a possible solution to resolve these alerts using only the Express license? Or does this mean that I can never use more than one aspect without buying a pro or end result? I would be willing to try to implement my own dependency controller if I could remove these warnings this way.

+5
source share
1 answer

AspectTypeDependency requires Professional edition. But the AspectTypeDependency type must be included even in Express Edition - then you should use an unlicensed build-time error.

You can use AspectPriority:

 [Validation1(AspectPriority = 1), Validation2(AspectPriority = 2)] 

Alternatively, you can assign priority in the aspect constructor. This is much less flexible than the layout aspect, but at least it removes the warning.

+5
source

All Articles