Async ConfigureAwait(false) Exception Handling-Long Running Processes

158 Views Asked by At

I have two long processes that are inside a Task.Run block that I want to run concurrently and capture any exceptions that may occur. I don't want to wait for these tasks to complete and I want to avoid deadlocks so I added ConfigureAwait(false). My first question is how do I execute both methods without waiting and handle the exception for either one? Currently my code looks like this:

Task.Run(async () =>
        {
            try
            {
                EmailTicket();
                PostETicket();
            }
            catch(Exception ex)
            {

            }

        }).ConfigureAwait(false);

If I place await before EmailTicket() and PostETicket() then only method catches the exception and the process ends. If I don't await for the process like above, will I run into any issues?

0

There are 0 best solutions below