private static void InterceptSynchronousResult <TResult>(AsyncInterceptor me, IInvocation invocation) { Task task = me.InterceptAsync(invocation, ProceedSynchronous <TResult>); if (!task.IsCompleted) { Task.Run(() => task).Wait(); } if (task.IsFaulted) { throw task.Exception.InnerException; } }
private static void HandleAsyncWithResult <TResult>(IInvocation invocation, AsyncInterceptor asyncInterceptor) { asyncInterceptor.InterceptAsynchronous <TResult>(invocation); }