elsa-workflows / elsa-workflows/elsa-core

Overriding CanExecute or CanExecuteAsync of Activity class causes Elsa Studio to crash

Open
#5,011 2 comments 0 reactions 0 assignees View on GitHub
bug elsa 3 triaged
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.
![image](https://github.com/elsa-workflows/elsa-core/assets/23342425/4130ddda-4136-43bd-9605-cee91b683876)

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.