Hi, not sure what you need to do in this task. Can you use something like this:
await taskA.ContinueWith( antecedent => Console.WriteLine("Today is {0}.", antecedent.Result) );
You can get the task result from antecedent
and the exceptions from antecedent.Exception
if there are any exceptions in the task.
By the way, I think you can just use await
keyword here and use try-catch block to wrapper the task. Because if there are any errors before the event trigger, the event trigger won't be executed. eg:
try
{
//do some tasks
await taskA();
await taskB();
this.DataLoaded?.Invoke(this, EventArgs.Empty);
}
catch(Exception ex)
{
//do something
}
Please correct me if I missed anything.