I'm trying to run the following code:
class Program
{
    static void Main(string[] args)
    {
        var task = Task.Factory.StartNew(() =>
            {
                throw new ApplicationException("message");
            });
        try
        {
            task.ContinueWith(t => Console.WriteLine("End"));
        }
        catch (AggregateException aex)
        {
            Console.Write(aex.InnerException.Message);
        }
    }
}
I expected that the Exception would be caught in the following location:
        catch (AggregateException aex)
        {
            Console.Write(aex.InnerException.Message);
        }
But this is not happening. Why is this so?