-
-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Ben.BlockingDetector/src/Ben.BlockingDetector/BlockingDetectionMiddleware.cs
Lines 31 to 42 in fce6c53
| var syncCtx = SynchronizationContext.Current; | |
| SynchronizationContext.SetSynchronizationContext(syncCtx == null ? _detectBlockingSyncCtx : new DetectBlockingSynchronizationContext(_monitor, syncCtx)); | |
| try | |
| { | |
| await _next(httpContext); | |
| } | |
| finally | |
| { | |
| SynchronizationContext.SetSynchronizationContext(syncCtx); | |
| } |
SetSynchronizationContext after awaiting on task restores context on continuation thread (not caller).See
npgsql/npgsql#1593
https://stackoverflow.com/questions/44418761/cross-thread-exception-after-async-call/44424562#44424562
@benaadams project seems like not maintained, just for your (and others) information.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels