title: Task.Factory.StartNew invoked on UI thread anyhow
body: <p>I have to deal with a strange problem, at least from my point of view. I use a Task to wait untill a variable gets a specific value and then run the Continue part on the ui thread again.</p>
  
  <p>Problem now is that before I call StartNew() and inside the call the ManagedThreadId is the same and it freezes my UI.</p>
  
  <p>Here my code:</p>
  
  <pre><code>// ManagedThreadId here
  Task.Factory.StartNew(() =&gt; 
  {
      // and here are the same.
      while (isClosing)
      {
          Thread.Sleep(50);
      }
  }).ContinueWith((finishedTask) =&gt; 
  {
      if (currentContainer != null)
      {
          window = currentContainer;
      }
      else
      {
           window = CreateBallonWindow();
           window.Show();
      }
  
      window.Activate();
  }, TaskScheduler.FromCurrentSynchronizationContext());
  </code></pre>
  
  <p>Ideas?</p>
  
  <p>Thanks Christoph</p>
  
  <p>EDIT:</p>
  
  <p>Most interesting for me is why this happens not how to get around this issue.
  I want to understand what happens there...</p>