In our project we used EF Core 2.2.6. But after upgrading to EF Core 3.1, the following piece of code stopped compiling and giving an error
var offerTask = DbContext.Offers.FindAsync(offerId);
var priceTask = DbContext.VendorPrices
.Where(x => x.OfferId == offerId && ...)
.ToListAsync(cancellationToken);
await Task.WhenAll(offerTask, priceTask);
Error CS1503
Argument 1: cannot convert from 'System.Threading.Tasks.ValueTask' to 'System.Threading.Tasks.Task'
I found out that in new version of EF Core, FindAsync method returns ValueTask (though in older version it returned Task), and this is causing the compilation error.
What is the workaround for this issue? Should I just use .AsTask()?
Ef core 3.1 breaking changes :
Solution: