title: Aysnc method still blocking the ui interface
body: <p>I have this method which is using ODBC and executes the reader async but the method is still blocking my UI for some reason it's loading 4000 records but I am wondering if someone can look at my code see where I am going wrong.</p>
  
  <pre><code>async Task&lt;BindingList&lt;PurchaseLinkHeaderC&gt;&gt; GetPurchaseOrders( IProgress&lt;int&gt; progress)
  {
      BindingList&lt;PurchaseLinkHeaderC&gt; _purhcaseOrderList = new BindingList&lt;PurchaseLinkHeaderC&gt;();
      try
      {
          string sageDsn = ConfigurationManager.AppSettings["SageDSN"];
          string sageUsername = ConfigurationManager.AppSettings["SageUsername"];
          string sagePassword = ConfigurationManager.AppSettings["SagePassword"];
          //using (var connection = new OdbcConnection("DSN=SageLine50v24;Uid=Manager;Pwd=;"))
  
          using (var connection =
              new OdbcConnection(String.Format("DSN={0};Uid={1};Pwd={2};", sageDsn, sageUsername, sagePassword)))
          {
              connection.Open();
              string fromD = dtpFrom.Value.ToString("yyyy-MM-dd");
              string toD = dtpTo.Value.ToString("yyyy-MM-dd");
  
              string SQL =
                  "SELECT 'ORDER_NUMBER', 'ORDER_OR_QUOTE', 'ORDER_DATE', 'DELIVERY_DATE', 'ORDER_STATUS_CODE', 'ORDER_STATUS', 'DELIVERY_STATUS_CODE', 'DELIVERY_STATUS', 'ACCOUNT_REF', 'NAME', 'ADDRESS_1', 'ADDRESS_2', 'ADDRESS_3', 'ADDRESS_4', 'ADDRESS_5', 'C_ADDRESS_1', 'C_ADDRESS_2', 'C_ADDRESS_3', 'C_ADDRESS_4', 'C_ADDRESS_5', 'DEL_NAME', 'DEL_ADDRESS_1', 'DEL_ADDRESS_2', 'DEL_ADDRESS_3', 'DEL_ADDRESS_4', 'DEL_ADDRESS_5', 'VAT_REG_NUMBER', 'REFERENCE', 'CONTACT_NAME', 'TAKEN_BY', 'SUPP_ORDER_NUMBER', 'SUPP_TEL_NUMBER', 'NOTES_1', 'NOTES_2', 'NOTES_3', 'SUPP_DISC_RATE', 'FOREIGN_ITEMS_NET', 'FOREIGN_ITEMS_TAX', 'FOREIGN_ITEMS_GROSS', 'ITEMS_NET', 'ITEMS_TAX', 'ITEMS_GROSS', 'TAX_RATE_1', 'TAX_RATE_2', 'TAX_RATE_3', 'TAX_RATE_4', 'TAX_RATE_5', 'NET_AMOUNT_1', 'NET_AMOUNT_2', 'NET_AMOUNT_3', 'NET_AMOUNT_4', 'NET_AMOUNT_5', 'TAX_AMOUNT_1', 'TAX_AMOUNT_2', 'TAX_AMOUNT_3', 'TAX_AMOUNT_4', 'TAX_AMOUNT_5', 'COURIER_NUMBER', 'COURIER_NAME', 'CONSIGNMENT', 'CARR_NOM_CODE', 'CARR_TAX_CODE', 'CARR_DEPT_NUMBER', 'CARR_DEPT_NAME', 'FOREIGN_CARR_NET', 'FOREIGN_CARR_TAX', 'FOREIGN_CARR_GROSS', 'CARR_NET', 'CARR_TAX', 'CARR_GROSS', 'FOREIGN_INVOICE_NET', 'FOREIGN_INVOICE_TAX', 'FOREIGN_INVOICE_GROSS', 'INVOICE_NET', 'INVOICE_TAX', 'INVOICE_GROSS', 'CURRENCY', 'CURRENCY_TYPE', 'EURO_GROSS', 'EURO_RATE', 'FOREIGN_RATE', 'SETTLEMENT_DUE_DAYS', 'SETTLEMENT_DISC_RATE', 'FOREIGN_SETTLEMENT_DISC_AMOUNT', 'FOREIGN_SETTLEMENT_TOTAL', 'SETTLEMENT_DISC_AMOUNT', 'SETTLEMENT_TOTAL', 'PAYMENT_REF', 'PRINTED', 'PRINTED_CODE', 'POSTED', 'POSTED_CODE', 'QUOTE_STATUS_ID', 'RECURRING_REF', 'DUNS_NUMBER', 'PAYMENT_TYPE', 'BANK_REF', 'GDN_NUMBER', 'PROJECT_ID', 'ANALYSIS_1', 'ANALYSIS_2', 'ANALYSIS_3', 'INVOICE_PAYMENT_ID', 'RESUBMIT_INVOICE_PAYMENT_REQUIRED', 'RECORD_CREATE_DATE', 'RECORD_MODIFY_DATE', 'RECORD_DELETED' FROM 'PURCHASE_ORDER' WHERE ORDER_DATE &gt;='{0}' and ORDER_DATE &lt;='{1}'";
  
              int counter = 0;
              using (var command = new OdbcCommand(string.Format(SQL, fromD, toD), connection))
              {
                  using (var reader = await command.ExecuteReaderAsync())
                  {
                      while (await reader.ReadAsync())
                      {
                          var purhcaseOrders = new PurchaseLinkHeaderC();
                          if ((reader["ORDER_NUMBER"] != ""))
                          {
                              counter++;
  
                              string orderNumber = Convert.ToString(reader["ORDER_NUMBER"]);
                              purhcaseOrders.Order_Number = OrderNumber.ToString();
                              purhcaseOrders.PurchaseOrderNo = Convert.ToInt32(reader["ORDER_NUMBER"]);
                              purhcaseOrders.Name = reader["NAME"].ToString();
                              purhcaseOrders.Selected_PurchaseOrder = false;
                              _purhcaseOrderList.Add(purhcaseOrders);
                          }
                      }
                  }
              }
          }
      }
      catch (Exception ex)
      {
          var logger = NLog.LogManager.GetCurrentClassLogger();
          logger.Info(ex, "Error at GetSalesOrders " + ex.ToString());
      }
  
      return _purhcaseOrderList;
  }
  </code></pre>
  
  <p>I want to be able to show a progress bar of the list being loaded so I was attempting to call it as this way. But I am not sure how to attach the progress method either.</p>
  
  <pre><code>var progressIndicator = new Progress&lt;int&gt;(ReportProgress);
  //call async method
  BindingList&lt;PurchaseLinkHeaderC&gt; purchaseOrders = await GetPurchaseOrders(progressIndicator);
  _masterPurchaseOrders = purchaseOrders;
  </code></pre>
  
  <p>I am hoping that someone can help here.</p>