I encounter many trouble with this error in an ASP Net CORE mvc project and I didn't find a way to solve it :
A second operation started on this context before a previous operation
completed. Any instance members are not guaranteed to be thread safe
It append on a non async function :
public Employee GetEmployeeByuserID(String userID)
{
return _applicationDBContext.Employee.Where(e => e.UserId.Equals(userID)).First();
}
I've try to make this function async but it just make the error append somewhere else.
The function is in a DAL with a dependency injection of _applicationDBContext. The Dal is declared is declared in AddTransient in the startup.cs I've seen some solution with an await but I counld'n find where I'm suppose to put it.
EDIT
If I made a breakpoint to pause the code before return _applicationDBContext.Employee.Where(e => e.UserId.Equals(userID)).First();
and continue, it work well.