static void OnInnerSend(IAsyncResult result) { if (result.CompletedSynchronously) { return; } SendAsyncResult thisPtr = (SendAsyncResult)result.AsyncState; Exception completionException = null; try { thisPtr.innerChannel.EndSend(result); } #pragma warning suppress 56500 // Microsoft, transferring exception to another thread catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completionException = e; } thisPtr.Cleanup(completionException == null); thisPtr.Complete(false, completionException); }
static void OnEnterComplete(object state, Exception asyncException) { SendAsyncResult thisPtr = (SendAsyncResult)state; bool completeSelf = false; Exception completionException = asyncException; if (completionException != null) { completeSelf = true; } else { try { completeSelf = thisPtr.WriteCore(); } #pragma warning suppress 56500 // [....], transferring exception to another thread catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completeSelf = true; completionException = e; } } if (completeSelf) { thisPtr.Cleanup(completionException == null, asyncException == null); thisPtr.Complete(false, completionException); } }
static void OnOpen(IAsyncResult result) { if (result.CompletedSynchronously) { return; } SendAsyncResult thisPtr = (SendAsyncResult)result.AsyncState; Exception completionException = null; bool completeSelf = false; try { thisPtr.CompleteOpen(result); completeSelf = thisPtr.SendMessage(); } #pragma warning suppress 56500 // Microsoft, transferring exception to another thread catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completeSelf = true; completionException = e; } if (completeSelf) { thisPtr.Cleanup(completionException == null); thisPtr.Complete(false, completionException); } }
static void OnWriteComplete(object asyncState) { SendAsyncResult thisPtr = (SendAsyncResult)asyncState; Exception completionException = null; try { thisPtr.channel.FinishWritingMessage(); } #pragma warning suppress 56500 // [....], transferring exception to another thread catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completionException = e; } thisPtr.Cleanup(completionException == null, true); thisPtr.Complete(false, completionException); }