Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An exception thrown when setting Step.Outputs from json #1310

Open
k-ahmedhm opened this issue Oct 21, 2024 · 0 comments
Open

An exception thrown when setting Step.Outputs from json #1310

k-ahmedhm opened this issue Oct 21, 2024 · 0 comments

Comments

@k-ahmedhm
Copy link

Describe the bug
I'm receiving this exception message when trying to use a Step with Outputs from json,
Here is my Json :

{
  "Id": "RandomNumberWorkflow",
  "Version": 1,
  "Steps": [
    {
      "Id": "GenerateRandomNumber",
      "StepType": "WorkflowCoreTestApp.GenerateRandomNumberStep, WorkflowCoreTestApp",
      "Outputs": {
        "GeneratedNumber": "GeneratedNumber"
      }
    }
  ]
}

Here is RandomNumberWorkflow code :

public class GenerateRandomNumberStep : StepBody
{
    public int GeneratedNumber { get; set; } = 0;

    public override ExecutionResult Run(IStepExecutionContext context)
    {
        var random = new Random();
        GeneratedNumber = random.Next(1, 100);  // Generate a random number between 1 and 100
        Console.WriteLine($"Generated number: {GeneratedNumber}");
        return ExecutionResult.Next();
    }
}

And here is the Exception Message :

System.ArgumentNullException: 'Value cannot be null. (Parameter 'indexer')'

And here is the StackTrace :

  at System.ArgumentNullException.Throw(String paramName)
   at System.ArgumentNullException.ThrowIfNull(Object argument, String paramName)
   at System.Linq.Expressions.Expression.ValidateIndexedProperty(Expression instance, PropertyInfo indexer, String paramName, ReadOnlyCollection`1& argList)
   at System.Linq.Expressions.Expression.Property(Expression instance, PropertyInfo indexer, Expression[] arguments)
   at WorkflowCore.Services.DefinitionStorage.DefinitionLoader.AttachDirectlyOutput(KeyValuePair`2 output, WorkflowStep step, Type dataType, LambdaExpression sourceExpr, ParameterExpression dataParameter)
   at WorkflowCore.Services.DefinitionStorage.DefinitionLoader.AttachOutputs(StepSourceV1 source, Type dataType, Type stepType, WorkflowStep step)
   at WorkflowCore.Services.DefinitionStorage.DefinitionLoader.ConvertSteps(ICollection`1 source, Type dataType)
   at WorkflowCore.Services.DefinitionStorage.DefinitionLoader.Convert(DefinitionSourceV1 source)
   at WorkflowCore.Services.DefinitionStorage.DefinitionLoader.LoadDefinition(String source, Func`2 deserializer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant