title: "MultiThreaded Execution was detected" error within Azure Orchestrator Function
body: <p>I'm attempting to follow the code as an example laid out here, <a href="https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-eternal-orchestrations?irgwc=1&amp;OCID=AID2000142_aff_7593_1375745&amp;tduid=(ir__6jtlnbrfc0kft3svkk0sohznxn2xi0sgvpzqs0fg00)(7593)(1375745)()()&amp;irclickid=_6jtlnbrfc0kft3svkk0sohznxn2xi0sgvpzqs0fg00&amp;tabs=csharp" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-eternal-orchestrations?irgwc=1&amp;OCID=AID2000142_aff_7593_1375745&amp;tduid=(ir__6jtlnbrfc0kft3svkk0sohznxn2xi0sgvpzqs0fg00)(7593)(1375745)()()&amp;irclickid=_6jtlnbrfc0kft3svkk0sohznxn2xi0sgvpzqs0fg00&amp;tabs=csharp</a>, for creating an Eternal Orchestration in Durable Functions.</p>
  <p>Currently, I have an HTTP triggered function</p>
  <pre><code>[FunctionName(&quot;Trigger_Eternal_Orchestration&quot;)]
  public static async Task&lt;HttpResponseMessage&gt; OrchestrationTrigger(
      [HttpTrigger(AuthorizationLevel.Function, &quot;post&quot;, Route = null)] HttpRequestMessage request,
      [DurableClient] IDurableOrchestrationClient client)
  {
      string id = request.Query[&quot;Id&quot;];
  
      await client.StartNewAsync(&quot;Periodic_Cleanup_Loop&quot;, instanceId).ConfigureAwait(false); 
      return client.CreateCheckStatusResponse(request, instanceId);
  }
  </code></pre>
  <p>and the orchestration trigger function as</p>
  <pre><code>[FunctionName(&quot;Periodic_Cleanup_Loop&quot;)]
  public static async Task Run(
      [OrchestrationTrigger] IDurableOrchestrationContext context)
  {
      DateTime nextCleanup = context.CurrentUtcDateTime.AddSeconds(10);
      await context.CreateTimer(nextCleanup, CancellationToken.None);
      Console.WriteLine(&quot;Going again&quot;);
      context.ContinueAsNew(null);
  }
  </code></pre>
  <p>Right now I'm just trying to see the eternal orchestration work (see the print out every 10 seconds) but after only one execution I always get the error:</p>
  <blockquote>
  <p>Multithreaded execution was detected. This can happen if the orchestrator function code awaits on a task that was not created by a DurableOrchestrationContext method.</p>
  </blockquote>
  <p>I'm not sure what the error is exactly based on the message given that the orchestration function only has one await and it is on something that is created with the context.</p>