Can anyone explain why async functions in c# 5 are required to have at least 1 await? I can't find a clear reason/explaination.
By required, I mean that the compiler warns when an async function doesn't have any await calls inside of it, but doesn't throw a compile error.
From this answer:
Similarly, a method marked as async must have at least one await. On an await, the runtime will save the current thread's state and call stack, make the asynchronous call, and unwind back to the runtime's message loop to handle the next message and keep the app responsive. When the asynchronous operation is complete, at the next scheduling opportunity, the call stack to up the async operation is pushed back in and continued as if the call was synchronous.
But from msdn:
If the method does not contain an await expression or statement, then it executes synchronously. A compiler warning alerts you to any async methods that don't contain await because that situation might indicate an error.
What type of error occur that merits this being a compiler warning versus just recommended usage?