I am not sure if you are using Dependency Injection to resolve your DbContext in your .net core application. If you are using native IoC from .NET Core (or any other IoC-Container) and you are getting this error, ensure to register your DbContext as Transient as:
AddDbContext or AddScoped adds the context as scoped, which may be cause troubles when working with multiple threads.
Also async / await operations can cause this behavior, when using async lambda expressions.
Adding db context as transient also has its drawbacks. You will not be able to make changes to some entity over multiple classes that are using the context because each class will get its own instance of your DbContext.
Posted On: 19-Apr-2019 21:44