workflow-core icon indicating copy to clipboard operation
workflow-core copied to clipboard

Value cannot be null. (Parameter 'value')

Open henrydingchina opened this issue 2 years ago • 0 comments

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<GbSubdomainsGetSyncTaskHistoryWorkflow>() .Input(step => step.InputSyncTaskId, data => data.SyncTaskId) .Output(data => data.SyncTaskHistory, step => step.OutputSyncTaskHistory))

` public override async Task<ExecutionResult> 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.

henrydingchina avatar Jul 24 '23 03:07 henrydingchina