The DataContext
class is part of LINQ to SQL. It does not understand async
/await
AFAIK, and should not be used with the Entity Framework async
extension methods.
The DbContext
class will work fine with async
as long as you are using EF6 or higher; however, you can only have one operation (sync or async) per DbContext
instance running at a time. If your code is actually using DbContext
, then examine the call stack of your exception and check for any concurrent usage (e.g., Task.WhenAll
).
If you are sure that all access is sequential, then please post a minimal repro and/or report it as a bug to Microsoft Connect.