static void StartComplete(IAsyncResult resultParameter) { if (resultParameter.CompletedSynchronously) { return; } InvokeAsyncResult invokeResult = resultParameter.AsyncState as InvokeAsyncResult; Fx.Assert(invokeResult != null, "Async state should have been of type InvokeAsyncResult."); try { invokeResult.serviceInstance = invokeResult.durableInstance.EndStartOperation(resultParameter); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } invokeResult.Complete(false, e); return; } if (invokeResult.DoInvoke()) { invokeResult.Complete(false, invokeResult.completionException); } }
static void InvokeComplete(IAsyncResult resultParameter) { if (resultParameter.CompletedSynchronously) { return; } InvokeAsyncResult invokeResult = resultParameter.AsyncState as InvokeAsyncResult; Fx.Assert(invokeResult != null, "Async state should have been of type InvokeAsyncResult."); try { invokeResult.returnValue = invokeResult.invoker.innerInvoker.InvokeEnd(invokeResult.serviceInstance, out invokeResult.outputs, resultParameter); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } ServiceErrorHandler.MarkException(e); invokeResult.completionException = e; } finally { if (invokeResult.DoFinish()) { invokeResult.Complete(false, invokeResult.completionException); } } }
static void FinishComplete(IAsyncResult result) { if (result.CompletedSynchronously) { return; } InvokeAsyncResult invokeResult = result.AsyncState as InvokeAsyncResult; Fx.Assert(invokeResult != null, "Async state should have been of type InvokeAsyncResult."); try { invokeResult.durableInstance.EndFinishOperation(result); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } invokeResult.completionException = e; } invokeResult.Complete(false, invokeResult.completionException); }