title: My UI thread is blocked when await Dispatcher.BeginInvoke... (using WPF and WCF)
body: <p>I have a WPF window that creates and starts a timer in its constructor. The timer elapsed event triggers a method (SyncPTUpdate) which uses BeginInvoke to place a call to another method (PTProgressUpdateInThread) onto the Window's thread. This then calls a WCF call asynchronously (using the TAP pattern, auto-generated by VS 2013).</p>
  
  <p>When I make the WCF call artificially long in duration (using thread.sleep in the server component), the UI of my WPF application freezes. Not initially, but after a few seconds have gone by.</p>
  
  <p>Where am I going wrong?</p>
  
  <pre><code>public delegate void PTProgressDelegate();
  
  // this method is called from a periodically firing timer (System.Timers)
  private async void SyncPTUpdate(object sender, ElapsedEventArgs e)
  {
      await this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new PTProgressDelegate(PTProgressUpdateInThread));
  }
  
  private async void PTProgressUpdateInThread()
  {
      PTMapFieldClient = new FieldClient();
      ServiceField.BlokPTProgress PTProgressFromServer = await PTMapFieldClient.GetPTProgressAsync(variousparametershere);
      PTMapFieldClient.Close();
  
      // now use the results of the WCF call to update the Window UI
      //...
  }
  </code></pre>