I have this example from C# 5 in a Nutshell book, by Albahari. The author states that 'unlike threads, tasks propagate exception'. However, below, "Null" is never written on the console. This is rather confusing, example code below
Task task = Task.Run(() => { throw new NullReferenceException("null"); });
try
{
task.Wait();
}
catch (AggregateException aex)
{
if(aex.InnerException is NullReferenceException)
Console.WriteLine("Null");
else
{
throw;
}
}
UPDATE:
Screenshot below
This is the complete snippet, so nothing is missing. Any help greatly appreciated. Thanks