/// <summary>
        /// Enables exception interception on the given type.
        /// </summary>
        /// <param name="visitable">The target type.</param>
        /// <param name="methodFilter">The method filter functor that will determine which methods should support exception interception.</param>
        public static void InterceptExceptions(this IReflectionVisitable visitable, Func<MethodReference, bool> methodFilter)
        {
            if (visitable == null)
                throw new ArgumentNullException("visitable");

            var catchAllThrownExceptions = new CatchAllThrownExceptions();
            visitable.WeaveWith(catchAllThrownExceptions, methodFilter);
        }
        public static void InterceptExceptions(this IReflectionVisitable visitable, Func <MethodReference, bool> methodFilter)
        {
            if (visitable == null)
            {
                throw new ArgumentNullException("visitable");
            }

            var catchAllThrownExceptions = new CatchAllThrownExceptions();

            visitable.WeaveWith(catchAllThrownExceptions, methodFilter);
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Enables exception interception on the given type.
        /// </summary>
        /// <param name="visitable">The target type.</param>
        /// <param name="methodFilter">
        ///     The method filter functor that will determine which methods should support exception
        ///     interception.
        /// </param>
        public static void InterceptExceptions(this AssemblyDefinition visitable,
                                               Func <MethodReference, bool> methodFilter)
        {
            if (visitable == null)
            {
                throw new ArgumentNullException("visitable");
            }

            IMethodWeaver catchAllThrownExceptions = new CatchAllThrownExceptions();

            visitable.WeaveWith(catchAllThrownExceptions, methodFilter);
        }