Hello
AggregateException
is an exception that contains all the individual exceptions thrown on all threads.
So basically something went wrong one or several threads and some exceptions were thrown in
Parallel.ForEach(sales, (salesInfoPPC) => listSalesResultPPC.Add(ppcManageShortSalesHelper(salesInfoPPC)));
You can catch the
AggregateException
and use it's
Handle
method to know what the problem was.
catch (AggregateException ae) {
ae.Handle((x) =>
{
if (x is ArgumentNullException)
{
return true;
}
else if (x is UnauthorizedAccessException)
{
return true;
}
else is (Exception ex)
{
}
return false;
});
}
Valery.