public static void AwaitIfAsync(this AspectContext aspectContext, object returnValue)
 {
     if (returnValue == null)
     {
         return;
     }
     if (returnValue is Task task)
     {
         if (task.IsFaulted)
         {
             var innerException = task.Exception?.InnerException;
             throw aspectContext.InvocationException(innerException);
         }
     }
 }
 public static async Task AwaitIfAsync(this AspectContext aspectContext, object returnValue)
 {
     if (returnValue == null)
     {
         return;
     }
     if (returnValue is Task task)
     {
         try
         {
             await task;
         }
         catch (Exception ex)
         {
             throw aspectContext.InvocationException(ex);
         }
     }
 }
 internal static void AwaitIfAsync(this AspectContext aspectContext, object returnValue)
 {
     if (returnValue == null)
     {
         return;
     }
     if (returnValue is Task task)
     {
         if (task.IsFaulted)
         {
             var innerException = task.Exception?.InnerException;
             throw aspectContext.InvocationException(innerException);
         }
         if (!task.IsCompleted)
         {
             task.GetAwaiter().GetResult();
         }
     }
 }