I am having a task like below.
var task = Task<string>.Factory.StartNew(() => longrunningmethod() .ContinueWith(a => longrunningmethodcompleted((Task<string>)a, TaskScheduler.FromCurrentSynchronizationContext()))); task.Wait(); My task will call the longrunningmethod and after completing it will call completed method. Inside my longrunningmethod I am delaying by Thread.Sleep(30000). When I use Task.wait system hangs and it's not calling longrunningmethodcompleted method. If I don't use Task.wait everything flows good.