You are developing a C# (.NET Isolated process) Durable Function orchestrator named InventoryAuditOrchestrator to coordinate a nightly inventory synchronization workflow. The orchestrator must retrieve a list of store locations, generate a unique audit tracking identifier (GUID) for each location, call an activity function to perform the audit, and record the completion timestamp.
You write the following orchestrator function code:
csharp
[Function("InventoryAuditOrchestrator")]
public static async Task RunOrchestrator(
[OrchestrationTrigger] TaskOrchestrationContext context)
{
var stores = await context.CallActivityAsync<List<string>>("GetStoreLocations", null);
foreach (var store in stores)
{
Guid auditId = Guid.NewGuid();
DateTime auditTime = DateTime.UtcNow;
var auditData = new AuditPayload(store, auditId, auditTime);
await context.CallActivityAsync("RunStoreAudit", auditData);
}
}
During testing, you notice that the workflow fails during execution replay, resulting in mismatched audit identifiers and timestamps across replays.
Which modification must you apply to the orchestrator code to resolve the replay errors and guarantee deterministic execution?
- Replace the Guid.NewGuid() call with context.NewGuid() and replace the DateTime.UtcNow call with context.CurrentUtcDateTime.Answer
- BConfigure the function app to use an Azure Functions Premium hosting plan to support multi-threaded and non-deterministic operations.
- CRun the Guid.NewGuid() and DateTime.UtcNow calls inside a Task.Run() block to offload them to a separate thread pool thread.
- DDecorate the orchestrator function with the [NoReplay] attribute to disable state replay and allow direct system calls.