I have an WebService that creates a task and a continuation task.
In the first task we set Thread.CurrentPrincipal
Hence, When the Continuat
Call the continuation with TaskScheduler.FromCurrentSynchronizationContext():
Task UITask= task.ContinueWith(() => { this.TextBlock1.Text = "Complete"; }, TaskScheduler.FromCurrentSynchronizationContext());
Copied from https://stackoverflow.com/a/4331287/503969