I'm trying to use fody with MethodDecorator on assembly level.
I tried to use the attribute provided by the sample code without any changes:
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor |
AttributeTargets.Assembly | AttributeTargets.Module)]
public class InterceptorAttribute : Attribute, IMethodDecorator {
// The code of the implemented methods doesn't matter.
}
If I decorate a method using [Interceptor]
all is working as expected.
But I try to intercept every method in my assembly. The sample code targets this attribute to AttributeTargets.Assembly
. That signals me that this might be working.
To get that done I added [assembly: InterceptorAttribute]
to AssemblyInfo.cs
of my project.
The code still compiles without any error but the interceptor will not be called.
The same happens if I use [module: Interceptor]
.
What do I have to do to get this working?
Is there any other way to intercept every method in an assembly/module?
UPDATE
I found MethodBoundaryAspect that works as expected.