Skip to content

Commit

Permalink
Add validation before getting workflow in GenerateWorkflowInputAccessors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sfmskywalker committed May 28, 2024
1 parent 4111077 commit 4393d95
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ public Task HandleAsync(EvaluatingCSharp notification, CancellationToken cancell
{
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 {");
Expand Down

0 comments on commit 4393d95

Please sign in to comment.