dotnet / dotnet/runtime

[RuntimeAsync] Runtime Async may not honor ExecutionContext.SuppressFlow().

Open
#122,052 4 comments 0 reactions 1 assignee Claimed by @VSadov View on GitHub
area-VM-coreclr runtime-async
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

Flowing execution context when it is suppressed is observable. One purpose for suppressing could be hiding secrets, although most commonly the flow is suppressed for performance reasons.

Not reacting to suppression may result in failures like:

```
System.Net.Sockets.Tests.ExecutionContextFlowTest.SocketAsyncEventArgs_ExecutionContextFlowsAcrossSendAsyncOperation(suppressContext: True, sendMode: 2) [FAIL]
Assert.Equal() Failure: Values differ
Expected: 0
Actual: 42
Stack Trace:
/_/src/libraries/System.Net.Sockets/tests/FunctionalTests/ExecutionContextFlowTest.cs(345,0): at System.Net.Sockets.Tests.ExecutionContextFlowTest.SocketAsyncEventArgs_ExecutionContextFlowsAcrossSendAsyncOperation(Boolean suppressContext, Int32 sendMode)
/_/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncHelpers.CoreCLR.cs(478,0): at System.Runtime.CompilerServices.AsyncHelpers.RuntimeAsyncTaskCore.DispatchContinuations[T,TOps](T task)
--- End of stack trace from previous location ---
--- End of stack trace from previous location ---
Finished: System.Net.Sockets.Tests
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.