Skip to content

Conversation

nytian
Copy link
Contributor

@nytian nytian commented Oct 2, 2025

This PR supports register custom provider that help include exception properties at TaskFailureDetails. Supports include running with both DurableTaskWorker and Durable Functions (.NET Isolated).

Note: related PR :

@nytian nytian changed the title Include Exception Properties at FailueDetails Include Exception Properties at FailureDetails Oct 2, 2025
}
}

static P.TaskFailureDetails? GetFailureDetails(FailureDetails? failureDetails)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove this because we will call the one at ptobufutils instead

@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Question: is this the right place to put this file? Customer need to refer this interface so they need to use this package. I guess I should put it here but I am not 100% sure.

exception.StackTrace,
FromExceptionRecursive(exception.InnerException));
FromExceptionRecursive(exception.InnerException),
null);// might need to udpate this later
Copy link
Contributor Author

@nytian nytian Oct 2, 2025

Choose a reason for hiding this comment

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

Question for the public static TaskFailureDetails FromException(Exception exception)

I checked all the reference, and it seems all the cases we called this is when the exception is a DTCore.OrchestrationExcep, which means it should already have properties included. Thus currently we don't need to extract properties here.

But I am not sure if there might be a case when the exception is not from dt.core and this return new ... is reached. If so, then we need to extract properties in this repo, which means I need to update OrchestrationContextWrapper class etc. But I didn't find a case like this from current code path. Let me know if there is any other thought on this.

? new(new(p.Name), p.OrchestrationInstance.InstanceId)
: null;

DurableTaskShimFactory factory = services is null
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I only updated line 211 to 226.. the whole file changed because of the VS outlining thing

@nytian nytian requested review from cgillum and YunchuWang October 6, 2025 19:34
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

A few initial comments. Haven't reviewed everything yet.

/// <param name="InnerFailure">The inner cause of the task failure.</param>
public record TaskFailureDetails(string ErrorType, string ErrorMessage, string? StackTrace, TaskFailureDetails? InnerFailure)
/// <param name="Properties">Additional properties associated with the exception.</param>
public record TaskFailureDetails(string ErrorType, string ErrorMessage, string? StackTrace, TaskFailureDetails? InnerFailure, IDictionary<string, object?>? Properties)
Copy link
Member

Choose a reason for hiding this comment

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

Even better if this could be IReadOnlyDictionary, which is immutable, but if it's too much trouble, then this is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can do that. The only thing is that at DT.Core we set this as IDictionary, so we just need to add some helper method here to convert those

Copy link
Member

Choose a reason for hiding this comment

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

Probably not worth doing a conversion. This is fine as-is.

@@ -1,2 +1,2 @@
# The following files were downloaded from branch main at 2025-09-17 01:45:58 UTC
https://raw.githubusercontent.com/microsoft/durabletask-protobuf/f5745e0d83f608d77871c1894d9260ceaae08967/protos/orchestrator_service.proto
# The following files were downloaded from branch nytian/failure-details at 2025-10-01 21:51:24 UTC
Copy link
Member

Choose a reason for hiding this comment

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

Reminder to update this to main once the protobuf changes in durabletask-protobuf are merged.

string stringValue = value.StringValue;

// Try to parse as DateTime if it's in ISO format
if (DateTime.TryParse(stringValue, null, DateTimeStyles.RoundtripKind, out DateTime dateTime))
Copy link
Member

Choose a reason for hiding this comment

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

This seems a bit risky. Could we provide some hints in the string value to know if it's actually a datetime or not?

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.

2 participants