You can't return Task.Yield()
, it's not a Task
but YieldAwaitable
for use with await
, and it actually introduces asynchrony (I posted some more details here).
I use Task.FromResult(Type.Missing)
for this purpose. Perhaps, the most efficient, albeit undocumented option is Task.Delay(0)
, it returns a static completed task.