Does MulticastAttributeUsage.AutoReplace work?

Do you program directly PostSharp.CodeModel or another low-level API and need help? Put your questions here and we will try to answer.

Does MulticastAttributeUsage.AutoReplace work?

Postby Ed_ward on Thu Dec 20, 2007 11:07 pm


Hi Gael!
I cannot recognize MulticastAttributeUsage.AutoReplace does not work or I misunderstand its meaning.
Attribute declaration
[MulticastAttributeUsage( MulticastTargets.Method | MulticastTargets.Constructor,  AllowMultiple = true, AutoReplace = true )]
public class ValidateArgumentsAttribute : MulticastAttribute,IRequirePostSharp
{//...}
Attribute using
[ValidateArguments(AttributePriority = 500 )]
class Test
{
[ValidateArguments( AttributePriority = 10)]
static void TestAspects( [NotNull] object test )
{
//...
}
}

Advice is applied to the TestAspects method twice, I tried to swap AttributePriority value but it does not help.
When I use MulticastAttribute.AttributeReplace property it works as expected, so advice is applied once.

Ed.ward

Edward Pavlov
Ed_ward
 
Posts: 11
Joined: Sat Jan 12, 2008 4:55 pm
Full Name: Edward Pavlov

Re: Does MulticastAttributeUsage.AutoReplace work?

Postby gfraiteur on Fri Dec 21, 2007 7:10 am

This *should* work. If it does not, please report a bug :).

AttributePriority only influences priority at the same level (assembly/class/level). Lower levels have always higher priority over higher levels.

Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
gfraiteur
Site Admin
 
Posts: 651
Joined: Tue Dec 18, 2007 3:09 pm
Full Name: Gael Fraiteur
Company: postsharp.org


Return to PostSharp Core


cron