You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are seeing crashes when an async connect operation is canceled. Analyses of the crash leads me to believe that SocketAsyncEventArgsAwaitable.SetCompleted is being called twice: once during the handling of the cancel and once when the IOCompletion fires. However the code that runs the continuationAction does not handle this condition appropriately and runs the continuationAction twice, causing the InvalidOperationException. Changing this line in SetCompleted:
var continuation = continuationAction ?? Interlocked.CompareExchange(ref continuationAction, SENTINEL, null);
to:
var continuation = Interlocked.Exchange(ref continuationAction, SENTINEL);