title: How to consume async a service with a client that implements ClientBase interface?
body: <p>I have this contract:</p>
  
  <pre><code>[ServiceContract]
      public interface ICalculadoraService
      {
          // TODO: Add your service operations here
          [OperationContract()]
          int Add(int num1, int num2);
  
          [OperationContract()]
          Task&lt;int&gt; AddAsync(int num1, int num2);
      }
  </code></pre>
  
  <p>I have this implementation:</p>
  
  <pre><code>public class CalculadoraService : ICalculadoraService
      {
          public int Add(int num1, int num2)
          {
              return num1 + num2;
          }
  
          public async Task&lt;int&gt; AddAsync(int num1, int num2)
          {
              return num1 + num2;
  
          }
      }
  </code></pre>
  
  <p>In my client side I have this proxy that implements the ClientBase interface:</p>
  
  <pre><code>class WCFCalculadoraServiceProxy : ClientBase&lt;ICalculadoraService&gt;, ICalculadoraService
      {
          public int Add(int num1, int num2)
          {
              //Lo que hace es llamar al método del servicio.
              return base.Channel.Add(num1, num2);
          }
  
          public Task&lt;int&gt; AddAsync(int num1, int num2)
          {
              //Lo que hace es llamar al método del servicio.
              return base.Channel.AddAsync(num1, num2);
          }
      }
  </code></pre>
  
  <p>And I have a console application in my client that use this proxy:</p>
  
  <pre><code>class Program
      {
          static void Main(string[] args)
          {
              WCFCalculadoraServiceProxy miProxy = new WCFCalculadoraServiceProxy();
              try
              {
                  addAsync(miProxy);
              }
              catch
              {
                  //TODO
              }
              finally
              {
                  miProxy.Close();
              }
          }
  
          private static async void addAsync(WCFCalculadoraServiceProxy paramProxy)
          {
              int resultado = await paramProxy.AddAsync(1, 2); //is reached
              Console.WriteLine("Service is host at " + DateTime.Now.ToString()); // is not reached
              Console.WriteLine("El resultado de sumar 1 y 2 es: " + resultado);
              Console.WriteLine("Host is running... Press &lt;Enter&gt; key to stop");
              Console.ReadKey();
              Console.ReadLine();
          }
      }
  </code></pre>
  
  <p>The problem is that the console does not show the result. It reaches the first line of the method AddAsync, but after a few seconds, the console is closed, so the text of the first writeline is not shown.</p>
  
  <p>I would like to know how to solve this problem and to know what is the correct way to consume a service asynchronously from a client that implements the ClientBase interface.</p>
  
  <p>If I add a service reference it works, but I would like to know why my solution does not work.</p>
  
  <p>Thanks.</p>