Example #1
0
        private void WeaveExitJoinPoint(
            MethodDefinition method,
            ILProcessor processor,
            IReadOnlyCollection <IAdviceInfo> advices,
            ICanAddMethodWeavingRecord statistics,
            string propertyName,
            string methodSignature)
        {
            var instructions = new List <Instruction>();

            if (advices != null && advices.Any())
            {
                UpdateLocalVariablesOnExit(method, instructions, processor);

                // inject advices
                for (var i = 0; i < advices.Count; i++)
                {
                    var advice = advices.ElementAt(i);
                    CallAdvice(method, processor, advice, instructions, propertyName, methodSignature);
                    var record = StatisticsFactory.InitializeWeavingRecord(
                        JoinPoint.Exit, advice.AspectName, advice.Advice.GetFullName(), advice.Advice.GetSignatureWithTypeFullName(), i);
                    statistics.AddWeavingRecord(record);
                }
            }

            CompleteWeavingExit(method, instructions, processor);
        }