MethodBoundaryAspect.Fody icon indicating copy to clipboard operation
MethodBoundaryAspect.Fody copied to clipboard

Global Aspect weaves it's own OnEntry method, ends up with a StackOverflowException

Open haefele opened this issue 6 years ago • 4 comments

Hello, I have an simple OnMethodBoundaryAspect that is supposed to do some logging for me. I apply it to the assembly, so it get's added to every class and method in the assembly. But my aspect is in that assembly too. So it will be added to it's own OnEntry method, which will lead to a StackOverflowException.

public class MyAspect : OnMethodBoundaryAspect
{
    public override void OnEntry(MethodExecutionArgs args)
    {
        Console.WriteLine("OnEntry");
    }
}

In AssemblyInfo.cs

[assembly: MyAspect]

image

haefele avatar Dec 30 '19 14:12 haefele

I have the same issue. I've moved my OnMethodBoundaryAspect to a separate assembly to solve it.

whiterabbit7516 avatar Jan 03 '20 11:01 whiterabbit7516

I also have such issue. Can you fix it please?

DamirAinullin avatar May 19 '20 13:05 DamirAinullin

As a workaround you can apply the DisableWeavingAttribute to your aspect class/method

I try to implement as default behavior that aspects wont weave themselves

Ralf1108 avatar Oct 18 '21 19:10 Ralf1108

should be fixed in v2.0.144

Ralf1108 avatar Oct 20 '21 22:10 Ralf1108