static void OnCompleted(IAsyncResult ar) { CallbackState state = (CallbackState)ar.AsyncState; ParallelAsyncResult <TWorkItem> thisPtr = state.AsyncResult; try { thisPtr.endCall(thisPtr.iteratorAsyncResult, state.AsyncData, ar); thisPtr.TryComplete(null, false); } catch (Exception e) { thisPtr.TryComplete(e, false); } }
static void OnCompleted(IAsyncResult ar) { CallbackState state = (CallbackState)ar.AsyncState; ParallelAsyncResult <TWorkItem> thisPtr = state.AsyncResult; try { thisPtr.endCall(thisPtr.iteratorAsyncResult, state.AsyncData, ar); thisPtr.TryComplete(null, ar.CompletedSynchronously); } catch (Exception e) when(!Fx.IsFatal(e)) { thisPtr.TryComplete(e, ar.CompletedSynchronously); } }