public void Intercept(Castle.DynamicProxy.IInvocation underlying) { // This implements the `IProxy.Interceptor` property: if (underlying.Method == proxyInterceptorGetter) { underlying.ReturnValue = this.interceptor; return; } var invocation = new Invocation(underlying); try { this.interceptor.Intercept(invocation); underlying.ReturnValue = invocation.ReturnValue; } catch (Exception ex) { invocation.Exception = ex; throw; } finally { invocation.DetachFromUnderlying(); } }