using System.Threading.Tasks;
public static void Main()
Task[] tasks = new Task[10];
for (int i = 0; i < tasks.Length; i++)
tasks[i] = Task.Run(() =>
WhereAmI(savedI.ToString());
throw new Exception("argh!");
WhereAmI(savedI.ToString() + " will never get here");
Console.WriteLine($"all complete, not necessarily ok!");
public static void WhereAmI(string nameOfTask)
Console.WriteLine($"task: {nameOfTask}. managed thread id {Thread.CurrentThread.ManagedThreadId}");