-
Type: Bug
-
Resolution: Duplicate
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Summary
When `ServerMonitor` calls `_roundTripTimeMonitor.RunAsync()`, it does not suppress the execution context flow. Because of that, any value present in the execution context when the connection to the server is initialized (= usually when the first instance of `MongoClient` is created) will be captured and kept alive forever by the RoundTripMonitor.
The behavior was observed in 2.13.2, but still present in current version.
How to Reproduce
```
public class Program
{
private static AsyncLocal<object[]> asyncLocal = new();
public static async Task Main(string[] args)
private static bool TestExecutionContextCapture(Action action)
private static WeakReference AllocateAndAssignPayload()
}
```
- duplicates
-
CSHARP-3813 Suppress execution context flow when initializing ServerMonitor
- Closed