Consider the follow method declared with async
async Task DoOneThingOrAnother()
{
if (condition == true)
{
// some non-awaitable task
localVar = "Done";
}
else
{
// some awaitable task
localVar = await svc.GetData();
}
}
Although the method is declared async, are there any negative side-effects with one route through the code does not using the await?
Will a caller that uses:
await DoOneThingOrAnother();
get the same experience regardless of which path through the called method was taken?
Am curious because a warning is raised in Visual Studio if there is NO await in an async method, but not if there is a potential path through the code that does not use an await.