Task<T> is simply not a covariant type.
Although List<T> can be converted to IEnumerable<T>, Task<List<T>> cannot be converted to Task<IEnumerable<T>>. And In #4, Task.FromResult(doctors) returns Task<List<DoctorDto>>.
In #3, we have:
return await Task.FromResult(doctors)
Which is the same as:
return await Task.FromResult<List<DoctorDto>>(doctors)
Which is the same as:
List<DoctorDto> result = await Task.FromResult<List<DoctorDto>>(doctors);
return result;
This works because List<DoctorDto> can be converted IEnumerable<DoctorDto>.