Skip to content

Activity input with complex types ends up as JSON Elements #430

@vegar

Description

@vegar

As part of an orchestration, I have an activity to store some metadata to a database before awaiting an external event.

The activity is defined like this:

[DurableTask("CreateAwaitedEvent")]
public class CreateAwaitedEventActivity : TaskActivity<CreateAwaitedEventActivityInput, Guid>
{
    public CreateAwaitedEventActivity(AppDbContext dbContext) { ... }

    public override async Task<Guid> RunAsync(TaskActivityContext context, CreateAwaitedEventActivityInput input) { ... }
}

public record CreateAwaitedEventActivityInput(EventType EventType, string OrchestratorId, Dictionary<string, object> Properties);

The activity is called from the orchestrator:

var eventId = await context.CallCreateAwaitedEventAsync(new CreateAwaitedEventActivityInput(EventType.ConfirmDeploymentPlan, context.InstanceId, new Dictionary<string, object>()
{
  {"ComponentContext", input},
  {"PlanResult", planResult}
}));

Inside of the activity, the objects added to the dictionary has changed from it's original type to JsonElements, as shown in the following picture:

Image

Is this a bug or expected behavior?
Is the behavior documented anywhere?
Can it be prevented?

The problem might be related to issue #36 which was marked solved back in 2022.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions