static void OnWriteMessage(IAsyncResult result) { if (result.CompletedSynchronously) { return; } StreamedFramingAsyncRequest thisPtr = (StreamedFramingAsyncRequest)result.AsyncState; Exception completionException = null; bool completeSelf; bool throwing = true; try { completeSelf = thisPtr.HandleWriteMessage(result); throwing = false; } #pragma warning suppress 56500 // Microsoft, transferring exception to another thread catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completeSelf = true; completionException = e; } finally { if (throwing) { thisPtr.Cleanup(); } } if (completeSelf) { thisPtr.Complete(false, completionException); } }
static void OnReceiveReply(IAsyncResult result) { StreamedFramingAsyncRequest thisPtr = (StreamedFramingAsyncRequest)result.AsyncState; Exception completionException = null; bool completeSelf; bool throwing = true; try { completeSelf = thisPtr.CompleteReceiveReply(result); throwing = false; } #pragma warning suppress 56500 // [....], transferring exception to another thread catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completeSelf = true; completionException = e; } finally { if (throwing) { thisPtr.Cleanup(); } } if (completeSelf) { thisPtr.Complete(false, completionException); } }