title: GTK GUI freezes with async/await and Progress<T>
body: <p>I'm using GTK# to build a GUI. Some data is processed in the background and I'd like to see some info about the progress on the user interface. Here is some code demonstrating the way I am trying to do this:</p>
  
  <pre><code>using System;
  using Gtk;
  using System.Threading.Tasks;
  using System.Threading;
  
  public partial class MainWindow: Gtk.Window
  {
      //a button and a textfield
      private VBox VB = new VBox();
      private Button B = new Button("Push dis");
      private Label L = new Label("0");
  
      public MainWindow () : base (Gtk.WindowType.Toplevel)
      {
  
          B.Clicked += OnClickEvent;
          ////////////////////
          VB.PackStart (B);
          VB.PackStart (L);
          Add (VB);
          ShowAll ();
          Build ();
      }
  
      protected void OnDeleteEvent (object sender, DeleteEventArgs a)
      {
          Application.Quit ();
          a.RetVal = true;
      }
  
      //async method incrementing variable, simulating some work and sending its progress
      protected async Task CounterGUIUpdateAsync(IProgress&lt;string&gt; progress)
      {
           await Task.Run (() =&gt; {
              for (int i = 0; i &lt;= 10000; i++) {
                  Thread.Sleep (100);
                  if(progress != null)
                  {
                      var stri = Convert.ToString(i);
                      progress.Report(stri);
  
                  }
              }
          });
      }
  
      //event handler for the button
      protected async void OnClickEvent(object sender, EventArgs e)
      {
          var ProgressIndicator = new Progress&lt;string&gt; (ReportProgress);
          await CounterGUIUpdateAsync (ProgressIndicator);
      }
  
      //action connected to the progress instance 
      protected void ReportProgress(string value)
      {
          L.Text = value;
      }
  }
  </code></pre>
  
  <p>Running the code will start off as expected, but at some point it is likely that the displayed counter gets stuck. The GUI won't update anymore, turning black if it has been minimized. It is still functional though. </p>
  
  <p>Help is appreciated very much. </p>