I'm playing around with the Azure Durable functions. Currently I'm getting InvalidOperationException
within Orchestration function after I call an activity. It complains that Multithreaded execution was detected. This can happen if the orchestrator function previously resumed from an unsupported async callback.
Have any one experienced such an issue? What I'm doing wrong? Complete code can be found on GitHub
Here is the line from the orchestration function:
var res = await ctx.CallActivityAsync<int>("LengthCheck", "inputData");
The LengthCheck
activitiy function is:
[FunctionName("LengthCheck")]
public static Task<int> Calc([ActivityTrigger] string input)
{
var task = Task.Delay(TimeSpan.FromSeconds(5));
task.Wait();
return Task.FromResult(input.Length);
}
The stack trace is:
ac6fd5cdd07a4dc9b2577657d65c4f27: Function 'InpaintOrchestration (Orchestrator)', version '' failed with an error. Reason: System.InvalidOperationException: Multithreaded execution was detected. This can happen if the orchestrator function previously resumed from an unsupported async callback.
at Microsoft.Azure.WebJobs.DurableOrchestrationContext.ThrowIfInvalidAccess()
at Microsoft.Azure.WebJobs.DurableOrchestrationContext.d__47`1.MoveNext()
End of stack trace from previous location where exception was thrown
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()