Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Commit

Permalink
[Fixes #5175] Async resource filters' short circuited result getting …
Browse files Browse the repository at this point in the history
…executed more than once.
  • Loading branch information
kichalla committed Aug 25, 2016
1 parent 7036e2b commit ece8f33
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
goto case State.ExceptionBegin;
}
}

case State.ResourceAsyncBegin:
{
Debug.Assert(state != null);
Expand Down Expand Up @@ -392,13 +392,14 @@ private Task Next(ref State next, ref Scope scope, ref object state, ref bool is
Canceled = true,
Result = _resourceExecutingContext.Result,
};
}

_diagnosticSource.AfterOnResourceExecution(_resourceExecutedContext, filter);
_diagnosticSource.AfterOnResourceExecution(_resourceExecutedContext, filter);

if (_resourceExecutingContext.Result != null)
{
goto case State.ResourceShortCircuit;
// A filter could complete a Task without setting a result
if (_resourceExecutingContext.Result != null)
{
goto case State.ResourceShortCircuit;
}
}

goto case State.ResourceEnd;
Expand Down Expand Up @@ -1222,7 +1223,7 @@ private async Task InvokeActionMethodAsync()
arguments,
controller);
logger.ActionMethodExecuting(controllerContext, orderedArguments);

var returnType = executor.MethodReturnType;
if (returnType == typeof(void))
{
Expand Down
Loading

0 comments on commit ece8f33

Please sign in to comment.