Skip to content

ORLEANS0014: Preserve the grain execution context

PropertyValue
CategoryUsage
SeverityWarning
Code fixAvailable

A grain or system-target method uses ConfigureAwait(false), or uses ConfigureAwaitOptions without ContinueOnCapturedContext.

The continuation can execute outside the grain scheduler and lose the activation’s execution context. Code after the await can then violate Orleans’ turn-based concurrency guarantees or observe the wrong grain context.

Prefer an ordinary await. When ConfigureAwait is required, use ConfigureAwait(true) or include ConfigureAwaitOptions.ContinueOnCapturedContext.

The code fix changes false to true, replaces ConfigureAwaitOptions.None, or adds ContinueOnCapturedContext to the existing options.

Suppress this diagnostic only when the complete continuation is intentionally context-free and cannot access grain or runtime state. Review the full post-await call path before suppressing it.

[*.cs]
dotnet_diagnostic.ORLEANS0014.severity = none