Beispiel #1
0
        /// <include file='doc\AsyncResult.uex' path='docs/doc[@for="AsyncResult.SyncProcessMessage"]/*' />
        public virtual IMessage     SyncProcessMessage(IMessage msg)
        {
            if (msg == null)
            {
                _replyMsg = new ReturnMessage(new RemotingException(Environment.GetResourceString("Remoting_NullMessage")), new ErrorMessage());
            }
            else if (!(msg is IMethodReturnMessage))
            {
                _replyMsg = new ReturnMessage(new RemotingException(Environment.GetResourceString("Remoting_Message_BadType")), new ErrorMessage());
            }
            else
            {
                _replyMsg = msg;
            }

            _isCompleted = true;
            FaultInWaitHandle();

            // If profiling, we want to notify the profiler that the remoting code is
            // essentially done (other than returning up the callstack, which happens
            // after the result is saved and/or used so doesn't really count for anything.
            if (RemotingServices.CORProfilerTrackRemotingAsync())
            {
                RemotingServices.CORProfilerRemotingClientInvocationFinished();
            }

            _AsyncWaitHandle.Set();
            if (_acbd != null)
            {
                // NOTE: We are invoking user code here!
                _acbd(this);
            }
            return(null);
        }