public void ServerCallback(IAsyncResult ar) { if (!(this._asyncEnd != (MethodInfo)null)) { return; } RemotingMethodCachedData reflectionCachedData1 = InternalRemotingServices.GetReflectionCachedData((MethodBase)this._asyncEnd); RemotingMethodCachedData reflectionCachedData2 = InternalRemotingServices.GetReflectionCachedData(this._msg.MethodBase); ParameterInfo[] parameters = reflectionCachedData1.Parameters; object[] objArray = new object[parameters.Length]; objArray[parameters.Length - 1] = (object)ar; object[] args = this._msg.Args; AsyncMessageHelper.GetOutArgs(reflectionCachedData2.Parameters, args, objArray); StackBuilderSink stackBuilderSink = new StackBuilderSink(this._serverObject); object[] outArgs1; object ret = stackBuilderSink.PrivateProcessMessage(this._asyncEnd.MethodHandle, Message.CoerceArgs((MethodBase)this._asyncEnd, objArray, parameters), this._serverObject, out outArgs1); if (outArgs1 != null) { outArgs1 = ArgMapper.ExpandAsyncEndArgsToSyncArgs(reflectionCachedData2, outArgs1); } stackBuilderSink.CopyNonByrefOutArgsFromOriginalArgs(reflectionCachedData2, args, ref outArgs1); object[] outArgs2 = outArgs1; int argCount = this._msg.ArgCount; LogicalCallContext logicalCallContext = Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext; IMethodCallMessage mcm = this._msg; this.AsyncProcessResponse((IMessage) new ReturnMessage(ret, outArgs2, argCount, logicalCallContext, mcm), (ITransportHeaders)null, (Stream)null); }
/// <include file='doc\ChannelSinkStacks.uex' path='docs/doc[@for="ServerChannelSinkStack.ServerCallback"]/*' /> public void ServerCallback(IAsyncResult ar) { if (_asyncEnd != null) { RemotingMethodCachedData asyncEndCache = (RemotingMethodCachedData) InternalRemotingServices.GetReflectionCachedData(_asyncEnd); MethodInfo syncMI = (MethodInfo)_msg.MethodBase; RemotingMethodCachedData syncCache = (RemotingMethodCachedData) InternalRemotingServices.GetReflectionCachedData(syncMI); ParameterInfo[] paramList = asyncEndCache.Parameters; // construct list to pass into End Object[] parameters = new Object[paramList.Length]; parameters[paramList.Length - 1] = ar; // last parameter is the async result Object[] syncMsgArgs = _msg.Args; // copy out and ref parameters to the parameters list AsyncMessageHelper.GetOutArgs(syncCache.Parameters, syncMsgArgs, parameters); Object[] outArgs; StackBuilderSink s = new StackBuilderSink(_serverObject); Object returnValue = s.PrivateProcessMessage(_asyncEnd, System.Runtime.Remoting.Messaging.Message.CoerceArgs(_asyncEnd, parameters, paramList), _serverObject, 0, false, out outArgs); // The outArgs list is associated with the EndXXX method. We need to make sure // it is sized properly for the out args of the XXX method. if (outArgs != null) { outArgs = ArgMapper.ExpandAsyncEndArgsToSyncArgs(syncCache, outArgs); } s.CopyNonByrefOutArgsFromOriginalArgs(syncCache, syncMsgArgs, ref outArgs); IMessage retMessage = new ReturnMessage( returnValue, outArgs, _msg.ArgCount, CallContext.GetLogicalCallContext(), _msg); AsyncProcessResponse(retMessage, null, null); } } // ServerCallback
public void ServerCallback(IAsyncResult ar) { if (this._asyncEnd != null) { RemotingMethodCachedData reflectionCachedData = InternalRemotingServices.GetReflectionCachedData(this._asyncEnd); MethodInfo mi = (MethodInfo)this._msg.MethodBase; RemotingMethodCachedData reflectionCachedData2 = InternalRemotingServices.GetReflectionCachedData(mi); ParameterInfo[] parameters = reflectionCachedData.Parameters; object[] array = new object[parameters.Length]; array[parameters.Length - 1] = ar; object[] args = this._msg.Args; AsyncMessageHelper.GetOutArgs(reflectionCachedData2.Parameters, args, array); StackBuilderSink stackBuilderSink = new StackBuilderSink(this._serverObject); object[] array2; object ret = stackBuilderSink.PrivateProcessMessage(this._asyncEnd.MethodHandle, Message.CoerceArgs(this._asyncEnd, array, parameters), this._serverObject, out array2); if (array2 != null) { array2 = ArgMapper.ExpandAsyncEndArgsToSyncArgs(reflectionCachedData2, array2); } stackBuilderSink.CopyNonByrefOutArgsFromOriginalArgs(reflectionCachedData2, args, ref array2); IMessage msg = new ReturnMessage(ret, array2, this._msg.ArgCount, Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext, this._msg); this.AsyncProcessResponse(msg, null, null); } }
public void ServerCallback(IAsyncResult ar) { if (this._asyncEnd != null) { object[] objArray3; RemotingMethodCachedData reflectionCachedData = InternalRemotingServices.GetReflectionCachedData((MethodBase)this._asyncEnd); MethodInfo methodBase = (MethodInfo)this._msg.MethodBase; RemotingMethodCachedData syncMethod = InternalRemotingServices.GetReflectionCachedData((MethodBase)methodBase); ParameterInfo[] parameters = reflectionCachedData.Parameters; object[] endArgs = new object[parameters.Length]; endArgs[parameters.Length - 1] = ar; object[] args = this._msg.Args; AsyncMessageHelper.GetOutArgs(syncMethod.Parameters, args, endArgs); StackBuilderSink sink = new StackBuilderSink(this._serverObject); object ret = sink.PrivateProcessMessage(this._asyncEnd.MethodHandle, Message.CoerceArgs(this._asyncEnd, endArgs, parameters), this._serverObject, 0, false, out objArray3); if (objArray3 != null) { objArray3 = ArgMapper.ExpandAsyncEndArgsToSyncArgs(syncMethod, objArray3); } sink.CopyNonByrefOutArgsFromOriginalArgs(syncMethod, args, ref objArray3); IMessage msg = new ReturnMessage(ret, objArray3, this._msg.ArgCount, CallContext.GetLogicalCallContext(), this._msg); this.AsyncProcessResponse(msg, null, null); } }