BorisWilhelms / azure-function-dependency-injection

Dependency Injection for Azure Functions v2
https://blog.wille-zone.de/
MIT License
145 stars 45 forks source link

What the aim of Task.Yield() here? #2

Closed sescandell closed 6 years ago

sescandell commented 6 years ago

Hi!

First of all: many thanks for your awesome blogpost and this sample. It made my usage of Azure function so much easier (with additional boilerplate but so much easier to use afterwards).

Just wondering: what the aim of the await Task.Yield() call in InjectBinding class?

Why do we need it?

Did you faced any issue without it?

Thanks !

MV10 commented 6 years ago

I was wondering the same thing. This StackOverflow answer has one of the better reviews of various Task.Yield scenarios I've seen, and it leads me to believe it's probably unnecessary here:

https://stackoverflow.com/a/23441833/152997

The WebJobs SDK behind Functions runs inside a scripthost instance, so none of those descriptions are directly applicable, but scenarios that truly require yields (or, at least, derive real benefits from it) are extremely rare.