I migrated WebAPI from FullDotnet (4.6) to .Net Core 2.0, and I had this problem in my data layer using Dapper.
My code is:
public List<Doctor> GetList() { List<Doctor> ret; using (var db = GetMySqlConnection()) { const string sql = @"SELECT D.Id, D.Bio, D.CRMState, D.CRMNumber, U.Id, U.Email, U.CreatedOn, U.LastLogon, U.Login, U.Name, U.Phone, U.Surname, U.Id, U.Birth, U.CPF, S.Id, S.Name from Doctor D inner join User U on U.Id = D.UserId inner join Speciality S on S.Id = D.IDEspeciality order by D.Id DESC"; ret = db.Query<Doctor, User, Speciality, Doctor>(sql, (doctor, user, speciality) => { doctor.User = user; doctor.Speciality = speciality; return doctor; } , splitOn: "Id, Id", commandType: CommandType.Text).ToList(); } return ret; }
Strange behavior:

Solution Build and WORK the Error that VisualStudio highlights:
The argument type 'lambda expression' is not assigned to the parameter type 'System.Func`5'
I have other classes with the same behavior and the same error, but, again, the code compiles and works , but this "highlight error" is annoying!
This is a highlight that I donβt have in my old solution using the .NET Framework 4.6
Useful information:
- Class Library: .Net Standard 2.0
- Visual Studio 2017 v15.4.1
- Resharper 2017.2