public static void Main(string[] args) { var demo = new DeadlockDemo(); demo.Test(); Console.WriteLine("No deadlock!"); }
protected override void OnStartup(StartupEventArgs e) { DeadlockDemo demo = new DeadlockDemo(); demo.Test(); Console.WriteLine("This will not be reached!"); // Deadlock here as UI thread is locked by t.Wait(); call }