无法将任务<List<TEntity>> 转换为任务<IList<TEntity>>

Cannot convert Task<List<TEntity>> to Task<IList<TEntity>>

我正在围绕 EF Core DbSet 编写一个小型包装器方法。我有以下方法:

public Task<IList<TEntity>> GetAsync(Func<IQueryable<TEntity>, IQueryable<TEntity>> getFunction)
{
    if (getFunction == null)
    {
        Task.FromResult(new List<TEntity>());
    }
    return getFunction(_dbSet).AsNoTracking().ToListAsync();
}

如您所见,class 是通用的,_dbSet 是上下文中具体 DbSet 的一个实例。然而,这对问题来说并不重要。
对于代码,我得到以下错误:

[CS0029] Cannot implicitly convert type 'System.Threading.Tasks.Task>' to 'System.Threading.Tasks.Task>'

如果我将 return 值更改为 Task<List<TEntity>>,则没有错误。
有谁知道为什么它不能转换它?谢谢!

我认为最简单的方法是等待任务。因此它将以最少的更改工作:

public async Task<IList<TEntity>> GetAsync(Func<IQueryable<TEntity>, IQueryable<TEntity>> 
getFunction)
{
    if (getFunction == null)
    {
        return new List<TEntity>();
    }
    return await getFunction(_dbSet).AsNoTracking().ToListAsync();
}