System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeMessage C# (CSharp) Method

DeserializeMessage() static private method

static private DeserializeMessage ( MemoryStream stm ) : IMessage
stm System.IO.MemoryStream
return IMessage
        internal static IMessage DeserializeMessage(MemoryStream stm)
        {
            return DeserializeMessage(stm, null);
        }

Same methods

CrossAppDomainSerializer::DeserializeMessage ( MemoryStream stm, IMethodCallMessage reqMsg ) : IMessage

Usage Example

        internal byte[] DoDispatch(byte[] reqStmBuff,
                                   SmuggledMethodCallMessage smuggledMcm,
                                   out SmuggledMethodReturnMessage smuggledMrm)
        {
            RemotingServices.LogRemotingStage(RemotingServices.SERVER_MSG_DESER);

            //*********************** DE-SERIALIZE REQ-MSG ********************

            IMessage desReqMsg = null;

            if (smuggledMcm != null)
            {
                ArrayList deserializedArgs = smuggledMcm.FixupForNewAppDomain();
                desReqMsg = new MethodCall(smuggledMcm, deserializedArgs);
            }
            else
            {
                MemoryStream reqStm = new MemoryStream(reqStmBuff);
                desReqMsg = CrossAppDomainSerializer.DeserializeMessage(reqStm);
            }

            // now we can delegate to the DispatchMessage to do the rest

            RemotingServices.LogRemotingStage(RemotingServices.SERVER_MSG_SINK_CHAIN);

            IMessage retMsg = ChannelServices.SyncDispatchMessage(desReqMsg);

            RemotingServices.LogRemotingStage(RemotingServices.SERVER_RET_SER);

            smuggledMrm = SmuggledMethodReturnMessage.SmuggleIfPossible(retMsg);
            if (smuggledMrm != null)
            {
                return(null);
            }
            else
            {
                if (retMsg != null)
                {
                    // Null out the principal since we won't use it on the other side.
                    // This is handled inside of SmuggleIfPossible for method call
                    // messages.
                    LogicalCallContext callCtx = (LogicalCallContext)
                                                 retMsg.Properties[Message.CallContextKey];
                    if (callCtx != null)
                    {
                        if (callCtx.Principal != null)
                        {
                            callCtx.Principal = null;
                        }
                    }
                    return(CrossAppDomainSerializer.SerializeMessage(retMsg).GetBuffer());
                }

                //*********************** SERIALIZE RET-MSG ********************
                return(null);
            }
        } // DoDispatch
All Usage Examples Of System.Runtime.Remoting.Channels.CrossAppDomainSerializer::DeserializeMessage