Add validation before getting workflow in GenerateWorkflowInputAccessors
This commit introduces a validation check in the GenerateWorkflowInputAccessors handler before trying to get the workflow. This prevents any potential issues if the workflow execution context is not available or retrievable. The code flow now first attempts to get the workflow execution context and if it's not available, it will return a completed task.
This commit is contained in:
parent
41110774a1
commit
4393d95505
|
|
@ -18,7 +18,11 @@ public class GenerateWorkflowInputAccessors : INotificationHandler<EvaluatingCSh
|
|||
{
|
||||
var expressionExecutionContext = notification.Context;
|
||||
var workflowInputs = expressionExecutionContext.GetWorkflowInputs().ToList();
|
||||
var workflow = expressionExecutionContext.GetWorkflowExecutionContext().Workflow;
|
||||
|
||||
if (!expressionExecutionContext.TryGetWorkflowExecutionContext(out var workflowExecutionContext))
|
||||
return Task.CompletedTask;
|
||||
|
||||
var workflow = workflowExecutionContext.Workflow;
|
||||
var inputDefinitions = workflow.Inputs.ToList();
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("public partial class WorkflowInputsProxy {");
|
||||
|
|
|
|||
Loading…
Reference in a new issue