private static void AsyncCompletionWrapperCallback(IAsyncResult result) { if (result != null) { if (!result.CompletedSynchronously) { AsyncResult asyncState = (AsyncResult)result.AsyncState; if (asyncState.OnContinueAsyncCompletion(result)) { AsyncResult.AsyncCompletion nextCompletion = asyncState.GetNextCompletion(); if (nextCompletion == null) { AsyncResult.ThrowInvalidAsyncResult(result); } bool flag = false; Exception exception = null; try { flag = nextCompletion(result); } catch (Exception exception2) { Exception exception1 = exception2; //TODO: /*if (!Fx.IsFatal(exception1)) * { * flag = true; * exception = exception1; * } * else * { * throw; * } */ throw; } if (flag) { asyncState.Complete(false, exception); } return; } else { return; } } else { return; } } else { throw new InvalidOperationException("InvalidNullAsyncResult"); //TODO: Fx.Exception.AsError(new InvalidOperationException(InternalSR.InvalidNullAsyncResult)); } }
private static void AsyncCompletionWrapperCallback(IAsyncResult result) { if (result == null) { throw Fx.Exception.AsError(new InvalidOperationException(InternalSR.InvalidNullAsyncResult)); } if (result.CompletedSynchronously) { return; } AsyncResult thisPtr = (AsyncResult)result.AsyncState; if (!thisPtr.OnContinueAsyncCompletion(result)) { return; } AsyncCompletion callback = thisPtr.GetNextCompletion(); if (callback == null) { ThrowInvalidAsyncResult(result); } bool completeSelf = false; Exception completionException = null; try { completeSelf = callback(result); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completeSelf = true; completionException = e; } if (completeSelf) { thisPtr.Complete(false, completionException); } }