elsa-workflows / elsa-workflows/elsa-core
Overriding CanExecute or CanExecuteAsync of Activity class causes Elsa Studio to crash
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
Hello,
We have implemented our own Activities that implement the CodeActivity class and ultimately the Activity class.
In our activities we override the CanExecute method of the Activity class to set our business logic for the activity to execute or not
This part works like a charm.
However when we click the "Run workflow" button in the workflow editor then it crashes the application based on a 404 of the server.

I traced the issue back to "WorkflowInstanceObserverFactory.cs" in [this line of code](https://github.com/elsa-workflows/elsa-studio/blob/259b6b5c4818d8c26aa3f74299449ad7114aa656/src/modules/Elsa.Studio.Workflows/Services/WorkflowInstanceObserverFactory.cs#L40). It tries to start a SignalR connection but it fails to do so.
I implemented my own version of WorkflowInstanceObserverFactory and just wrapped the line of code in a try/catch and now the application is no longer crashing.
Although i found a solution myself, this might be worth investigating by the team or i could make a PR for it?
Contributor guide
Assessment
This issue has not been assessed yet.