You need to move the Dispatcher call to the continuation of the task, which will look something like this:
var task = Task.Factory .StartNew<List<NewTwitterStatus>>(() => GetTweets(securityKeys), TaskCreationOptions.LongRunning) .ContinueWith<List<NewTwitterStatus>>(t => { Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { var result = t.Result; RecentTweetList.ItemsSource = result; Visibility = result.Any() ? Visibility.Visible : Visibility.Hidden; })); }, CancellationToken.None, TaskContinuationOptions.None);
source share