-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
AsyncInterceptor is awesome, but it cannot handle faulted tasks.
On first glance it looks like one could override AfterInvoke(IInvocation invocation, Task task) and check the IsFaulted property of the task, but the last ContinueWith() contains this code:
invocationClone.ReturnValue = t.Result;
this.AfterInvoke(invocationClone);
this.AfterInvoke(invocationClone, t);
return (TResult)invocationClone.ReturnValue;
Thus, AfterInvoke() is only called if task.Result does not throw—which it will if the task is faulted!
What I believe is needed is a check of t.IsFaulted before accessing t.Result and then calling the virtual methods appropriately.
Metadata
Metadata
Assignees
Labels
No labels