Missing information in objected returned from Workflow when Activity failes

Hello all, I’m working on a PoC for using Temporal .NET SDK (version 1.2.0) in one of our flows and I started implementing some tests for it.

While working on the tests for scenarios where Activities fail, I noticed the returned results from the Workflow don’t contain the expected information added during the Workflow execution (i.e. error message). I have the impression a new instance of my result class is created and the info added during workflow execution is lost.

When the Activies work as expected (represented as Happy path in the example I provided), I have no issues and all expected data is present.

I created an environment to share the results I’m seeing at GitHub - guhcevalhos/temporal: Reproduce issue with Temporal.

Please let me know what other information I can provide to help look into this issue.

Thanks,
Gustavo

Before we debug your code, can you clarify the issue a bit? You are trapping the exception inside the workflow and returning. Are you saying that is not returning the value you are having it return? Can you show the exact stack trace from your test that fails in your GitHub repo? Are you expecting Data to not be null even though it is never set? Also, take a look at the history in the UI and see what the workflow result shows. Do your models properly work with System.Text.Json?

1 Like

Do your models properly work with System.Text.Json ?

This was the problem. By default System.Text.Json requires a public setter. Use immutable types and properties - .NET | Microsoft Learn

Thank you for your help!