public void Execute(AdviceSpec spec) { foreach (Navigator aspectNav in spec.AspectNavigators) { IMethodDefinition aspectMethod = Narrow.Interceptor(aspectNav, spec); foreach (Navigator targetNav in spec.TargetNavigators) { Instruction targetCallInstruction = Narrow.CallInstruction(targetNav, spec); MethodReference targetMethod = (MethodReference)targetCallInstruction.Operand; MethodDefinition containerMethod = Narrow.Method(targetNav.Parent, spec); // Prevent recursive weaving if (targetMethod != aspectMethod && containerMethod != aspectMethod && !Cil.BelongsToAspectDng(targetMethod) && !Cil.BelongsToAspectDng(aspectMethod) && !Cil.BelongsToAspectDng(containerMethod) && targetMethod.GenericParameters.Count == 0 && targetMethod.DeclaringType.GenericParameters.Count == 0) { // Cannot weave on acces to boxed arrays. Methods look like int32[0...,0...]::Get(int32, int32) if (targetMethod.DeclaringType.Name.IndexOf("]") == -1 && targetMethod.ToString().IndexOf("&") == -1 // To prevent base.SameMethod() calls from child types, event if AroundBody already occurred && Cil.GetOriginalMethodName(targetMethod) != Cil.GetOriginalMethodName(containerMethod) ) { AddInterceptor(targetCallInstruction, containerMethod, aspectMethod); } } } } }