Async / Await and SynchronicationContext (C# .Net)
Following innocuous looking async / await code will cause deadlock. To understand why, lets go into what await does in the above case. 1 Execution starts when the button is clicked and button1_Click event is fired on the UI thread. 2 The method, named LongRunningProcess, is invoked. 3 The lamda expression passed to Task.Run() executes in…