Skip to content

Include Exception Properties at FailureDetails via Custom Provider#3215

Merged
nytian merged 31 commits into
devfrom
nytian/failure-details
Oct 26, 2025
Merged

Include Exception Properties at FailureDetails via Custom Provider#3215
nytian merged 31 commits into
devfrom
nytian/failure-details

Conversation

@nytian

@nytian nytian commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

Issue describing the changes in this PR

Add support for including exception properties at TaskFailureDetails via custom provider

Note: This PR won't work unless microsoft/durabletask-dotnet#474 is merged.

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation PR is ready to merge and referenced in pending_docs.md
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)
  • My changes do not require any extra work to be leveraged by OutOfProc SDKs
    • Otherwise: That work is being tracked here: #issue_or_pr_in_each_sdk
  • My changes do not change the version of the WebJobs.Extensions.DurableTask package
    • Otherwise: major or minor version updates are reflected in /src/Worker.Extensions.DurableTask/AssemblyInfo.cs
  • My changes do not add EventIds to our EventSource logs
    • Otherwise: Ensure the EventIds are within the supported range in our existing Windows infrastructure. You may validate this with a deployed app's telemetry. You may also extend the range by completing a PR such as this one.
  • My changes should be added to v2.x branch.
    • Otherwise: This change applies exclusively to WebJobs.Extensions.DurableTask v3.x. It will be retained only in the dev and main branches and will not be merged into the v2.x branch.

@andystaples andystaples left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking mostly good - just one thing to discuss

Comment thread src/WebJobs.Extensions.DurableTask/OutOfProcMiddleware.cs Outdated
@nytian nytian marked this pull request as draft October 14, 2025 17:48
@nytian nytian marked this pull request as ready for review October 15, 2025 04:04
Comment thread test/e2e/Apps/BasicDotNetIsolated/CustomExceptionPropertiesOrchestration.cs Outdated
Comment thread test/e2e/Apps/BasicJava/extensions.csproj
Comment thread test/e2e/Tests/Tests/ErrorHandlingTests.cs Outdated
@nytian nytian requested review from andystaples and cgillum October 15, 2025 17:13
@nytian nytian requested a review from AnatoliB October 15, 2025 22:20

@cgillum cgillum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused about why we mix JSON and protobuf together in the same payloads. I don't remember us doing this before, so maybe I'm missing some context.

Comment thread src/WebJobs.Extensions.DurableTask/OutOfProcMiddleware.cs Outdated
Comment thread src/WebJobs.Extensions.DurableTask/OutOfProcMiddleware.cs Outdated
Comment thread src/WebJobs.Extensions.DurableTask/ProtobufUtils.cs
@nytian nytian requested a review from cgillum October 20, 2025 16:30

@andystaples andystaples left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments

Comment thread src/WebJobs.Extensions.DurableTask/OutOfProcMiddleware.cs
Comment thread test/e2e/Apps/BasicDotNetIsolated/CustomExceptionPropertiesOrchestration.cs Outdated
Comment on lines +683 to +688
JValue jv => ConvertJValueToValue(jv),
JArray ja => Value.ForList(ja.Select(ConvertObjectToValue).ToArray()),
JObject jo => Value.ForStruct(new Struct
{
Fields = { jo.Properties().ToDictionary(p => p.Name, p => ConvertObjectToValue(p.Value)) },
}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of questions about this

  1. Why Newtonsoft objects specifically, and not other JSON library objects?
  2. I notice we are not doing these Newtonsoft conversions in TaskFailureDetailsConverter.cs - is this deliberate?
  3. Also, this may be generally unintuitive for customers who expect their JValue properties to be returned as JValue (or the string equivalent) and instead get some defined object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these because, in the test case, some nested objects such as lists and dictionaries are serialized and deserialized as JSON values when passed from Worker.Extensions to WebJobs.Extensions. Therefore, we need to include this JSON block here.

For TaskFailureDetailsConverter, there’s no serialization or deserialization involved — it directly handles the object itself, so a JSON block isn’t needed there.

Yeah, if they specifically expect a JValue, we might be violating that here — but are there really many such cases? It seems that handling nested structures is more important overall. I’m fine with either approach, though. leave it as it-is for other folks to join the discussion..

Comment thread src/WebJobs.Extensions.DurableTask/ProtobufUtils.cs Outdated
Comment thread src/WebJobs.Extensions.DurableTask/ProtobufUtils.cs Outdated
Comment thread Directory.Packages.props Outdated
Comment thread src/WebJobs.Extensions.DurableTask/ProtobufUtils.cs Outdated
@nytian nytian merged commit 1529474 into dev Oct 26, 2025
15 checks passed
@nytian nytian deleted the nytian/failure-details branch October 26, 2025 01:49
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

Successfully merging this pull request may close these issues.

4 participants