elsa-workflows / elsa-workflows/elsa-core
Workflow Alteration Fails When Activities Are Added or Removed (Elsa 3.4)
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
I’m currently using Elsa 3.4. My workflow includes several long-running steps. During testing, I realized that I should use a sub-workflow instead of relying on ParallelForEach or child workflows. Previously, the structure was set up like this.
Now, I’d like to transition to using bulk workflow dispatch.
when I access xxx/alterations/run in the swagger, it returns a message like:
> "System.NullReferenceException: Object reference not set to an instance of an object.
> at Elsa.Workflows.WorkflowStateExtractor.g__CreateActivityExecutionContextState|10_0(ActivityExecutionContext activityExecutionContext)
> at System.Linq.Enumerable.IteratorSelectIterator`2.ToListNoPresizing()
> at System.Linq.Enumerable.IteratorSelectIterator`2.ToList()
> at Elsa.Workflows.WorkflowStateExtractor.ExtractActiveActivityExecutionContexts(WorkflowState state, WorkflowExecutionContext workflowExecutionContext)
> at Elsa.Workflows.WorkflowStateExtractor.Extract(WorkflowExecutionContext workflowExecutionContext)
> at Elsa.Alterations.Services.DefaultAlterationRunner.RunAsync(String workflowInstanceId, IEnumerable`1 alterations, CancellationToken cancellationToken)
> at Elsa.Alterations.Services.DefaultAlterationRunner.RunAsync(IEnumerable`1 workflowInstanceIds, IEnumerable`1 alterations, CancellationToken cancellationToken)
> at Elsa.Alterations.Endpoints.Alterations.Run.Run.HandleAsync(Request request, CancellationToken cancellationToken)
> at FastEndpoints.Endpoint`2.ExecAsync(CancellationToken ct)
> at FastEndpoints.Endpoint`2.ExecAsync(CancellationToken ct)
> at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger)
> at Elsa.Http.Middleware.HttpWorkflowsMiddleware.InvokeAsync(HttpContext httpContext, IServiceProvider serviceProvider)
> at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
> at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
> at NSwag.AspNetCore.Middlewares.SwaggerUiIndexMiddleware.Invoke(HttpContext context)
> at NSwag.AspNetCore.Middlewares.RedirectToIndexMiddleware.Invoke(HttpContext context)
> at NSwag.AspNetCore.Middlewares.OpenApiDocumentMiddleware.Invoke(HttpContext context)
> at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)"
request body looks like this-
```
{
"Alterations": [
{
"type": "Migrate",
"targetVersion": 189
},
{
"type": "ScheduleActivity",
"activityId": "84eb599efc9df4a7"
}
],
"WorkflowInstanceIds": [
"ca896fc4ba6e4283"
]
}
```
84eb599efc9df4a7 -> which refers to a previous activity, not the one that was deleted (just for context).
My question is:
Is it mandatory to include all existing activities when applying an alteration?
Is it not possible to add or remove activities during the alteration process?
Contributor guide
Assessment
This issue has not been assessed yet.