Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safely short circuit function invocation from invocation filter #1310

Open
kevbite opened this issue Aug 22, 2017 · 6 comments
Open

Safely short circuit function invocation from invocation filter #1310

kevbite opened this issue Aug 22, 2017 · 6 comments
Assignees
Labels
Milestone

Comments

@kevbite
Copy link

kevbite commented Aug 22, 2017

I'm trying to create a IFunctionInvocationFilter but I want to be able to safely short circuit the invocation of the function from a filter and pass back a return value.

It's currently possible to short circuit it by throwing an exception within the OnExecutingAsync method of the filter but sequential filters wont be called and the exception is bubbled up.

It would be useful if within the Invocation filters to be able to set a property that allows skipping of the function execution (similar to the MVC framework)

I could throw something together and submit a PR of an example of what I mean?

@kevbite
Copy link
Author

kevbite commented Aug 22, 2017

It might be useful if the result was also passed in and could be changed by the OnExecutedAsync on the filters too.

@mamaso
Copy link
Contributor

mamaso commented Aug 22, 2017

Looks like there's some value here - asp.net action filters appear to have a similar feature short-circuiting if result is set in a filter, we should try to mirror that behavior.

https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.Core/Filters/ActionFilterAttribute.cs#L49

@mathewc
Copy link
Member

mathewc commented Aug 22, 2017

We're tracking some remaining work items for Filters in this issue #1284. For the initial set of functionality we kept things scoped to get feedback. We have it on our TODO list to look at return values from filters, and I updated the issue to also mention short circuiting so we can explore that.

I created a new tracking item here for the all up Result/Cancel feature: #1314

@kevbite
Copy link
Author

kevbite commented Aug 22, 2017

That's great, I look forward to the features! Thanks

@christopheranderson christopheranderson added this to the Next milestone Aug 24, 2017
@mathewc mathewc modified the milestones: Sprint 5, Next Aug 24, 2017
@mathewc mathewc self-assigned this Aug 28, 2017
@paulbatum paulbatum modified the milestones: Sprint 5, Next Aug 28, 2017
@Gorthog
Copy link

Gorthog commented May 22, 2018

Can you please provide status update?

@joshua-hayes
Copy link

No progress on this halfway through 2019 now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants