public override MessageElement Next(MessageElement m, WrappedServiceSkelAsyncAdapter async_adapter) { using (m) { try { async_adapter.MakeAsync(); generator.AsyncNext().ContinueWith(t => async_adapter.EndTask <ReturnType>(t, async_ret => RobotRaconteurNode.s.PackAnyType <ReturnType>("return", ref async_ret))); return(null); } catch (Exception e) { using (MessageEntry merr = new MessageEntry()) { RobotRaconteurExceptionUtil.ExceptionToMessageEntry(e, merr); RRDirectorExceptionHelper.SetError(merr, e.ToString()); return(null); } } } }