title: Convert a method to use async
body: <p>I am converting a authentication process to support async and the VS 2015 IDE is warning me with the following message:
  <strong>The async method lacks 'await' operators and will run synchronously...</strong> etc...</p>
  
  <p>Anyway, the code connects to a LDAP store and verifies a user's account and etc...
  I have tried various things with await, but I am just missing something here.  I put the code back to what it was before.. I would appreciate any guidance in getting it to support async correctly... </p>
  
  <p>Here is the code:</p>
  
  <pre><code>public async Task&lt;User&gt; GetAsyncADUser(PrincipalContextParameter param)
      {
          try
          {
  
              if (UseLDAPForIdentityServer3)
              {
                  using (var pc = new PrincipalContext(ContextType.Domain, param.ADDomain, param.ADServerContainer, param.ADServerUser, param.ADServerUserPwd))
                  {
                      UserPrincipal userPrincipal = UserPrincipal.FindByIdentity(pc, param.UserNameToValidate);
                      if (userPrincipal != null)
                      {
                          bool isvalid = pc.ValidateCredentials(userPrincipal.DistinguishedName, param.UserPasswordToValidate, ContextOptions.SimpleBind);
  
                          if (isvalid)
                          {
                              User user = new User { ad_guid = userPrincipal.Guid.ToString(), Username = param.UserNameToValidate, Password = param.UserPasswordToValidate };
                              return user;
                          }
                      }
                  }
              }
  
          }
          catch (Exception ex)
          {
              throw;
          }
  
          return null;
  
      }
  </code></pre>