/// <summary> /// Ends the event for asynchronous interceptions. /// </summary> private static void EndAsyncAuditInterceptEvent(Task task, IInvocation invocation, InterceptEvent intEvent, AuditScope scope, object result) { intEvent.AsyncStatus = task.Status.ToString(); if (task.Status == TaskStatus.Faulted) { intEvent.Exception = task.Exception?.GetExceptionInfo(); } else if (task.Status == TaskStatus.RanToCompletion) { SuccessAuditInterceptEvent(invocation, intEvent, result); } scope.Dispose(); }