Skip to content

Commit 6eebfc2

Browse files
Merge pull request #312216 from kshyju/shkr/isolated-worker-synccontext
Document SynchronizationContext behavior in .NET isolated worker model
2 parents 1abe48f + cb355b8 commit 6eebfc2

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

articles/azure-functions/dotnet-isolated-process-guide.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Guide for running C# Azure Functions in an isolated worker process
33
description: Learn how to use the .NET isolated worker model to run your C# functions in Azure, which lets you run your functions on currently supported versions of .NET and .NET Framework.
44
ms.service: azure-functions
55
ms.topic: how-to
6-
ms.date: 12/06/2025
6+
ms.date: 02/24/2026
77
recommendations: false
88
ms.custom:
99
- template-concept
@@ -596,6 +596,15 @@ The cancellation token is signaled when the function invocation is canceled. Sev
596596

597597
This exception occurs when the cancellation token is canceled (as a result of one of the events described earlier) _before_ the host sends an incoming invocation request to the worker. This exception can be safely ignored and is expected when `SendCanceledInvocationsToWorker` is `false`.
598598

599+
## Async programming
600+
601+
The .NET isolated worker doesn't set a custom [`SynchronizationContext`](/dotnet/api/system.threading.synchronizationcontext). This means that `SynchronizationContext.Current` is `null` during function execution. After an `await`, continuations are scheduled on the thread pool, which is the standard .NET behavior.
602+
603+
Because there's no `SynchronizationContext` to suppress, using [`ConfigureAwait(false)`](/dotnet/api/system.threading.tasks.task.configureawait) in your function code has no practical effect. The isolated worker process runs as a standard .NET generic host (console app), so the same async/await behavior you'd expect in any ASP.NET Core or console application applies here. This is also true for .NET Framework (net48) isolated worker apps, since the worker process is always a console executable using `HostBuilder`.
604+
605+
> [!NOTE]
606+
> [Durable Functions](./durable/durable-functions-overview.md) orchestrators have their own threading constraints. The orchestrator replay thread must run continuations, so using `ConfigureAwait(false)` in orchestrator functions or orchestrator middleware can interfere with orchestration execution. For more information, see the [Durable Functions code constraints](./durable/durable-functions-code-constraints.md).
607+
599608
## Bindings
600609

601610
Define bindings by using attributes on methods, parameters, and return types. Bindings can provide data as strings, arrays, and serializable types, such as plain old class objects (POCOs). For some binding extensions, you can also [bind to service-specific types](#sdk-types) defined in service SDKs.

0 commit comments

Comments
 (0)