-
Notifications
You must be signed in to change notification settings - Fork 272
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
Issue with input serialization in Durable Function with Orchestrator #2801
Comments
Guess it's related to this closed issue : #2577 |
@jviau are you aware of issues related to polymorphic (de)serialization with STJ? |
I think I have ran into this before! In dotnet isolated, durable extension uses the worker-wide configured converter from WorkerOptions - which is an @fcu423 you can see if this repros for you locally: try serializing/deserializing via We will need to consider how to let a customer specify a separate convert for just durable. It might be possible today via adding your own |
Hello @jviau, I have the same issue while using:
Calling ScheduleNewOrchestrationInstanceAsync with input param of type Message, both fields are assigned the correct values:
But, when trying to retrieve ctx.GetInput(); --> Id has the correct Guid value and EntityId is an empty Guid (even if I have checked that it is assigned before the call). Could you please suggest me how can I handle this? Thanks. |
@amalea what is |
Hello @jviau, AppEntityId is a struct, like this:
I am not sure where exactly should I use serialization/deserialization in the above code. |
@amalea, this doesn't look like it is related to this issue as you are not using polymorphic serialization. Yours looks like a general serialization issue external to durable. I recommend you write unit tests to validate you can serialize/deserialize your payload with System.Text.Json outside of durable. |
Hello @jviau, I have tried to isolate the problem and it seems that using struct type does not work with durable functions isolated worker / or some other lib has a wrong impact.
In Program.cs, I have this line also: |
Description
Using .NET 8 and azure functions in isolated mode, I have an
EventGridTrigger
function that starts up an orchestrator while providing a typed input as parameter. The parameter's type is part of a class hierarchy. The orchestrator is receiving the input with the type of the base class and I am pattern checking this input against the type of the two subclasses to call the durable entity in one way or another.The issue is that the serializer is not respecting the
System.Text.Json
attributes to include the type hints so theinput
received in the orchestrator doesn't have any polymorphism information/data about the types that originated it.Expected behavior
I would expect to be able to check the input of the orchestrator against the type of any of the children classes.
Actual behavior
Pattern checking the base class against any of the children classes is always false.
Relevant source code snippets
The class hierarchy
The event grid function
The orchestrator
Known workarounds
As a workaround I:
Operation
enum in the base classcontext.GetInput<WorkItemCreatedIntegrationEvent>();
orcontext.GetInput<WorkItemProgressedIntegrationEvent>();
based on the value of the Operation enumApp Details
The text was updated successfully, but these errors were encountered: