danielgerlag / danielgerlag/workflow-core
Value cannot be null. (Parameter 'value')
- Dominant language
- C#
- Stars
- 5.9k
- Forks
- 1.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 5
Description
**Describe the bug**
When I use Recur again, I always get an error when I loop to the third time.
` WorkflowCore.Services.BackgroundTasks.IndexConsumer ? [Error indexing workfow - e82d8185-39c2-420c-b050-56f3abf0ae23 - Value cannot be null. (Parameter 'value')]`
**To Reproduce**
`
.Recur(data => TimeSpan.FromSeconds(5), data => data.SyncTaskHistory != null && data.SyncTaskHistory.Status == 2 )
.Do(recur => recur.StartWith()
.Input(step => step.InputSyncTaskId, data => data.SyncTaskId)
.Output(data => data.SyncTaskHistory, step => step.OutputSyncTaskHistory))
`
`
public override async Task RunAsync(IStepExecutionContext context)
{
try
{
InputSyncTaskHistory = await m_dbContext.SyncTaskHistory
.FirstOrDefaultAsync(x => x.TaskId == InputSyncTaskId, context.CancellationToken);
OutputSyncTaskHistory = InputSyncTaskHistory;
if (InputSyncTaskHistory.CatalogsNum == decimal.Zero)
{
return ExecutionResult.Next();
}
await m_dataflowService.Enqueue(new SyncGbSubdomainsDataflow(new SyncGbSubdomainsDetail
{
Id = InputSyncTaskHistory.SipServerId,
TaskId = InputSyncTaskHistory.TaskId,
Status = InputSyncTaskHistory.Status,
Progress = InputSyncTaskHistory.ActualCatalogsNum / InputSyncTaskHistory.CatalogsNum * 100
}, EntityOperation.Update));
OutputSyncTaskHistory = InputSyncTaskHistory;
}
catch (Exception ex)
{
_logger.Warn("Occur Exception:", ex);
}
return ExecutionResult.Next();
}`
**Expected behavior**
I want to get out of the loop when SyncTaskHistory!=null && SyncTaskHistory.Status==2 instead of reporting an error
**Additional context**
Add any other context about the problem here.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.