After executing this code:
try
{
DoSomething();
}
catch (TaskCanceledException e)
{
DealWithCancelledTaskException(e);
throw;
}
catch (Exception e)
{
DealWithNormalException(e);
throw;
}
The exception is raised.
DoSomething
is supposed to throw TaskCancelledException
, but it throws System.AggregateException
containing one exception of type TaskCancelledException
and is caught as normal Exception
.
How can I catch this exception as TaskCancelledException
?