danielgerlag / danielgerlag/workflow-core

NullReferenceException after upgrading 3.4.0 -> 3.8.1

Open
#1,155 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
5.9k
Forks
1.3k
Avg merge
1d 1h
Merged PRs (30d)
5

Description

We upgraded our library from 3.4.0 to 3.8.1.
We use PostgreSQL 14 as our backend and had to do a "manual upgrade" of the DB because the EF version used by the library wasn't supported by the the version we had.

Now things work most of the time but we have cases where interacting with the workflows raises `NullReferenceException`s.
Looking at the code it happens in `WorkflowActivity.Enrich(WorkflowStep workflowStep)` at line 65:
```
current.SetTag("workflow.step.type", (object) workflowStep.BodyType.Name);
```
our `workflowStep.BodyType` is `null` because we use `StepBodyAsync` (as described in https://workflow-core.readthedocs.io/en/stable/getting-started/) and not the `WorkflowStep` class.
We also see log entries like `[11:17:09 WorkflowCore.Services.WorkflowExecutor DBG] Starting step null on workflow eca3fed6-42bf-4ec8-b21b-72261e995ed7` for the same reason.

I didn't see any release notes mentioning a breaking change.
Is this a bug or do we need to make some changes?

We also see some `DbUpdateException` because of `ScheduledCommand` unique index constraint failing.
Are these also expected?

Cheers.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at WorkflowActivity.Enrich(WorkflowStep workflowStep), especially the line accessing workflowStep.BodyType.Name, and trace the related “Starting step null” log in WorkflowExecutor for workflows using StepBodyAsync. Reproduce the NullReferenceException and separately investigate the ScheduledCommand unique-index DbUpdateException; done means both failure modes are understood and their expected behavior or required change is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.