title: Event on Task Result is done
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5971686/how-to-create-a-task-tpl-running-a-sta-thread">How to create a task (TPL) running a STA thread?</a>  </p>
  </blockquote>
  
  
  
  <p>I'm using the following code:</p>
  
  <pre><code>var task = Task.Factory.StartNew&lt;List&lt;NewTwitterStatus&gt;&gt;(
          () =&gt; GetTweets(securityKeys),  
          TaskCreationOptions.LongRunning);
  
  Dispatcher.BeginInvoke(DispatcherPriority.Background,
      new Action(() =&gt;
      {
          var result = task.Result; // ERROR!!! The calling thread cannot access this object because a different thread owns it.
          RecentTweetList.ItemsSource = result;
          Visibility = result.Any() ? Visibility.Visible : Visibility.Hidden;
      }));
  </code></pre>
  
  <p>And I'm getting the error:</p>
  
  <pre><code>var result = task.Result; // ERROR!!! The calling thread cannot access this object because a different thread owns it.
  </code></pre>
  
  <p>What do I need to do to resolve this problem?</p>