ORLEANS0014: Preserve the grain execution context
| Property | Value |
|---|---|
| Category | Usage |
| Severity | Warning |
| Code fix | Available |
A grain or system-target method uses ConfigureAwait(false), or uses ConfigureAwaitOptions without ContinueOnCapturedContext.
Impact
Section titled “Impact”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.
How to fix
Section titled “How to fix”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 the diagnostic
Section titled “Suppress the diagnostic”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