title: Why my asyncResult is always null?
body: <p>I have the following program that uses async operation but the returning IAsyncResult.AsyncState is always null.  </p>
  
  <p>What I'm doing wrong?</p>
  
  <pre><code>public interface ICommandService
  {
  [OperationContract(AsyncPattern = true)]
  IAsyncResult BeginLogin(string userName, string password, AsyncCallback callback, object state);
  
  string EndLogin(IAsyncResult result);
  }
  
  class CommandService : ICommandService
  {
      public string Login(string userName, string password)
      {            
          return "dorcohen";
      }
  
      private Func&lt;string, string, string&gt; _LoginDelgateObject;
  
      public IAsyncResult BeginLogin(string userName, string password, AsyncCallback callback, object state)
      {
          Func&lt;string, string, string&gt; function = new Func&lt;string, string, string&gt;(Login);
          _LoginDelgateObject = function;
          IAsyncResult result = function.BeginInvoke(userName, password, callback, state);
          return result;
      }
  
      public string EndLogin(IAsyncResult result)
      {
          CommandService test = result.AsyncState as CommandService;
          return test._LoginDelgateObject.EndInvoke(result);
      }
  }
  </code></pre>