-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make concurrency check handle re-entrance #7375
Comments
This is a common user error. No two sync or async operations can be in flight at the same time. |
I have the same issue. var ret = _context.AppProgramMenus.Where(p =>
p.Active == true &&
(p.Program.Title.Contains(searchString) || p.Menu.Title.Contains(searchString)))
.Select(p =>
new RolMenuProgram
{
Id = p.ProgramMenuId,
ProgramTitle = p.Program.Title,
MenuTitle = p.Menu.Title,
canCreate = GetCRUD(p.ProgramMenuId, roleid, "C"),
canRead = GetCRUD(p.ProgramMenuId, roleid, "R"),
canUpdate = GetCRUD(p.ProgramMenuId, roleid, "U"),
canDelete = GetCRUD(p.ProgramMenuId, roleid, "D")
}); private bool GetCRUD(int programMenuId, int? roleId, string crud)
{
var ret = false;
var rmp = _context.AppRoleMenuPrograms.Where(r => r.ProgramMenuId == programMenuId && r.RoleId == roleId).SingleOrDefault(); **** ERROR SHOWS HERE ****
switch (crud)
{
case "C":
ret = rmp != null ? rmp.AllowCreate : false;
break;
case "R":
ret = rmp != null ? rmp.AllowRead : false;
break;
case "U":
ret = rmp != null ? rmp.AllowUpdate : false;
break;
case "D":
ret = rmp != null ? rmp.AllowDelete : false;
break;
}
return ret;
} |
@wgutierrezr It means you're trying to do two database operations at the same time. It's your job to make sure that doesn't happen. If you need to overlap database calls, you need two DbContexts. |
Hi, Using two context I had the same issue. |
@wgutierrezr Oh, I see your problem. While you're trying to load data from You need to change your first query from The |
We need to investigate the consequences of doing this further to avoid issues like #8864 |
Note from triage: Since using the context inside client eval of the function is blocked by this issue, and this is in turn blocked by #8864, @anpete is going to investigate #8864 again to see whether we can do something for 2.1. However, #8864 looks quite hard, so we will cycle back again after the investigation and decide how to proceed. |
Fixed in #17089 |
Thank you to every body, you help me alot. |
Getting exception below when making Async calls.
The text was updated successfully, but these errors were encountered: