Microsoft.Azure.WebJobs.Extensions.DurableTask v1.6.2
If you have an orchestrator call a sub orchestrator and that sub orchestrator calls an activity function which throws an exception, then the exception cannot be deserialised and you get "Failed to deserialize exception from TaskActivity"
Easy to reproduce like this:
public class MyOrchestrator
{
[FunctionName("MyTimer")]
public static async Task RunTimerAsync([TimerTrigger("0 */5 * * * *", RunOnStartup = true)]TimerInfo myTimer, [OrchestrationClient]DurableOrchestrationClient orchestrationClient, ILogger log)
{
log.LogInformation($"Executing");
string instanceId = await orchestrationClient.StartNewAsync("MyOrchestrator", "Test");
}
[FunctionName("MyOrchestrator")]
public static async Task RunOrchestratorAsync([OrchestrationTrigger] DurableOrchestrationContext context, ILogger logger)
{
try
{
await context.CallSubOrchestratorAsync("MySubOrchestrator", "Booooo");
}
catch (Exception ex)
{
//The exception here is Failed to deserialize exception from TaskActivity:
}
}
[FunctionName("MySubOrchestrator")]
public static async Task RunSubOrchestratorAsync([OrchestrationTrigger] DurableOrchestrationContext context, ILogger logger)
{
await context.CallActivityAsync("MyActivityFunction", "Booooo");
}
[FunctionName("MyActivityFunction")]
public static void RunActivityFunction([ActivityTrigger] DurableActivityContext context, ILogger logger)
{
throw new Exception("WTF");
}
}
please fix this!
Any updates on this? Looks like it might be related to #313 .
I see this issue has received a lot of votes! I'll take a look and see if we can get a fix in for the next release.
This appears to have been recently fixed by PR https://github.com/Azure/azure-functions-durable-extension/pull/628. I'm adding an automated test case to confirm and ensure it doesn't regress again. The fix will go out with the next release.
Resolved in v1.8.0 release.
This error is still happening in some cases in v1.8.0.
I have a much simpler case where simple orchestrator calls an activity that executes some SQL query. The query fails and activity throws SqlException. It seems that this kind of exception is especially nasty to serialize:
Microsoft.Azure.WebJobs.FunctionFailedException: The activity function 'GetViewers' failed: "Failed to deserialize exception from TaskActivity: {"$type":"System.Data.SqlClient.SqlException, System.Data.SqlClient","ClassName":"System.Data.SqlClient.SqlException","Message":"Invalid object name 'ActiveViewer_1_19'."
The whole stack trace is very long, but I think this is an interesting part:
System.InvalidCastException: Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'System.Guid'.
at System.Data.SqlClient.SqlException..ctor(SerializationInfo si, StreamingContext sc)
at lambda_method(Closure , Object[] )
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty member, String id)
There is indeed a Guid field in SqlException and it seems it causes the serialization issue:
"ClientConnectionId":"b8c66db2-dfcc-47f1-9f33-f3863f07b387"
This should be very easy to reproduce. Just make an activity that executes wrong SQL.
Sorry if this is a wrong place to make my comment.
Thanks @marcin-synak for this info. Would you mind opening a new issue to track this? That will make things easier for us from a book-keeping perspective.
Most helpful comment
please fix this!