public virtual IMessage SyncProcessMessage(IMessage msg)
{
IMessage replyMsg = null;
try
{
msg.Properties["__Uri"] = _realProxy.IdentityObject.URI;
if (_objectMode == WellKnownObjectMode.Singleton)
{
replyMsg = _realProxy.Invoke(msg);
}
else
{
// This is a single call object, so we need to create
// a new instance.
MarshalByRefObject obj = (MarshalByRefObject)Activator.CreateInstance(_serverType, true);
BCLDebug.Assert(RemotingServices.IsTransparentProxy(obj), "expecting a proxy");
RealProxy rp = RemotingServices.GetRealProxy(obj);
replyMsg = rp.Invoke(msg);
}
}
catch (Exception e)
{
replyMsg = new ReturnMessage(e, msg as IMethodCallMessage);
}
return replyMsg;
} // SyncProcessMessage