title: blocking main thread on async/await
body: <p>I am trying to make my base repository class asynchronous and I am running into some trouble. I am using Dapper ORM in my C# application. </p>
  
  <p><em>Base method</em></p>
  
  <pre><code>protected async Task&lt;List&lt;T&gt;&gt; Read&lt;T&gt;(CommandDefinition cmd) {
      using(SqlConnection myCon = new SqlConnection(Config.DBConnection)) {
          await myCon.OpenAsync();
  
          IEnumerable&lt;T&gt; results = await myCon.QueryAsync&lt;T&gt;(cmd);
  
          List&lt;T&gt; retVal = results.ToList();
  
          myCon.Close();
  
          return retVal;
      }
  }
  </code></pre>
  
  <p><em>Calling method</em></p>
  
  <pre><code>public List&lt;Category&gt; GetAllActiveCategories(Guid siteGuid) {
      return base.Read&lt;Category&gt;(SPNAME_GETALLACTIVE, siteGuid).Result;
  }
  </code></pre>
  
  <p>Everything looks in order to me. I have the method declaration decorated with the async keyword. I am awaiting on asynchronous methods.</p>
  
  <p>The problem that I am having is that the thread blocks on <code>await myCon.OpenAsync();</code>. This is my first attempt at using async and await, so I am sure that I am doing something wrong, but it is not obvious. Please help!</p>