|
|
|
Pierre-Emmanuel Dautreppe
Community Member
|
|
Hello all,
as described here http://www.pedautreppe.com/post/Generating-fields-in-an-existing-class---Using-PostSharp-15.aspx, I have created a low level aspect that is generating a public field into a class. To do that, I declare a MulticastAttribute with a plugin, task, and an advice to do that.
And this is working fine.
To go a bit further, I would like to add this low-level aspect to an existing CompoundAspect. But to do that I need a ILaosAspect.
So I change the inheritance of my attribute : from MulticastAttribute to LaosTypeLevelAspect. But after I have a compilation error : "PostSharp: Cannot find a weaver for the aspect type LowLevelAspect.InjectCodeAttribute. Are you sure it implements one of the supported interfaces?"
Do you have any clue about this ?
Many thanks !
|
|
|
|
|
Gael Fraiteur
SharpCrafters
|
|
You have to create a class, even empty, that implements ILaosAspect. The assembly declaring this class should not have references to PostSharp.Core.dll and PostSharp.Laos.Weaver.dll.
Then you should create the implementation of this aspect in an assembly referencing PostSharp.Laos.Weaver.dll. This assembly should contain a class derived from Task and implementing ILaosAspectWeaverFactory, and this interface is responsible for providing the weaver (LaosAspectWeaver) for the aspect (ILaosAspect).
This is illustrated in the sample PostSharp.Samples.Librarian (see Weaver).
-gael
|
|
|
|
|
Pierre-Emmanuel Dautreppe
Community Member
|
|
Thanks Gaël !
That's a way I had not seen before for low level aspects ! Interesting. I should dig further into weaver definition.
I have now something working fine !
|
|
|
|