-
Notifications
You must be signed in to change notification settings - Fork 1.3k
A second operation started on this context before a previous operation completed #219
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
Comments
I just tried this with the latest version from the master branch (0fbb47f), but I'm unable to reproduce the issue. Here's what I did:
Couple of questions:
|
Hi Sipke, thanks for looking at this. I can confirm that it works fine for me with Sqlite, but I'm trying to use SQL Server. This is with the latest build on master, and also if I create a separate project and add the current Elsa packages (v1.1.4.2). I'm using a local SQL Server Express v14.0.2027 If it helps here's my Startup class:
|
Hi Martin, I was able to reproduce the issue with SqlServer. For some reason, the following code appears to run in parallel instead of sequentially: var workflowModelTasks = workflows.Select(async x => await CreateWorkflowDefinitionListItemModelAsync(x, cancellationToken)); I would have expected that statement would basically iterate over each workflow in the list, async/awaiting each creation of a model object, like so: var workflowModels = new List<WorkflowDefinitionListItemModel>();
foreach (var workflow in workflows)
{
var workflowModel = await CreateWorkflowDefinitionListItemModelAsync(workflow, cancellationToken);
workflowModels.Add(workflowModel);
} The above works. Clearly I'm not understanding something correctly, but I committed the "explicit" for each loop to |
Great, thanks Sipke. |
Hi, not sure if this is something I have set up wrong, but I'm trying to test Elsa with the dashboard and designer and have used SQL Server as the EF provider. After successfully adding a couple of workflows I now get the 'second operation' error when trying to view the workflows list. Here's the stack trace:
I've stepped through the WorkflowDefinitionController.Index task and this line run's okay:
but then it errors out on the subsequent call:
Which, as you can see from the stack trace is getting as far as EntityFrameworkCoreWorkflowInstanceStore.ListByDefinitionAsync for the next call to the dbContext which throws the error.
Has anyone got any thoughts on what's causing this?
The text was updated successfully, but these errors were encountered: