Task<> does not contain a definition for 'GetAwaiter'
I had this issue in one of my projects, where I found that I had set my project's .Net Framework version to 4.0 and async tasks are only supported in .Net Framework 4.5 onwards.
I simply changed my project settings to use .Net Framework 4.5 or above and it worked.
Just experienced this in a method that executes a linq query.
public async Task<Foo> GetSomething()
{
return await (from foo in Foos
select foo).FirstOrDefault();
}
Needed to use .FirstOrDefaultAsync()
instead. N00b mistake.