title: Why won't DynamicProxy's interceptor get called for *each* virtual method call?
body: <p>An example explains it best :</p>
  
  <pre><code>public interface IA { 
    void foo();
    void bar();
  }
  
  public class A : IA {
    public virtual void foo(){
      Console.Write("foo");
      bar();                  //call virtual method
    }
    public virtual void bar(){
      Console.Write("bar");
    }
  }
  
  public class Interceptor : IInterceptor {
    public void Intercept(IInvocation invocation)
    {
      Console.WriteLine("Intercepted: " + invocation.Method.Name);
      invocation.Proceed();
    }
  }
  
  Main(){
    IA a = new A();
  
        //proxy-ing an interface, given an implementation
    IA proxy = new Castle.DynamicProxy.ProxyGenerator()
                   .CreateInterfaceProxyWithTarget(a, new Interceptor());
    proxy.foo();
  
  }
  </code></pre>
  
  <p>I would have expected the output:</p>
  
  <pre><code>Intercepted foo
  foo
  Intercepted bar
  bar
  </code></pre>
  
  <p>Instead, I get:</p>
  
  <pre><code>Intercepted foo
  foo
  bar
  </code></pre>
  
  <p>Why? </p>
  
  <p>How does the dynamic proxy work? 
  I was expecting the generated proxy to <em>inherit</em> from the proxied class, however, it seems that it uses <em>composition</em> to delegate each of the methods in the proxied interface to the actual implementation. </p>
  
  <p>I've tried with Castle DynamicProxy and also with an older dynamic proxy implementation, from <a href="http://www.cramon.dk/dynamicproxy.htm" rel="noreferrer">Cramon</a></p>