RealProxy的PrivateInvoke方法在构造调用时的执行代码

80酷酷网    80kuku.com

  执行
private void PrivateInvoke(ref MessageData msgData, int type)
{
IMessage message1 = null;
CallType type1 = (CallType) type;
IMessage message2 = null;
int num1 = -1;
RemotingProxy proxy1 = null;
////////////////////////
num1 = 0;
proxy1 = this as RemotingProxy;
ConstructorCallMessage message4 = null;
bool flag1 = false;
if (!this.IsRemotingProxy())
{
message4 = new ConstructorCallMessage(null, null, null, this.GetProxiedType());
}
else
{
message4 = proxy1.ConstructorMessage;
Identity identity1 = proxy1.IdentityObject;
if (identity1 != null)
{
flag1 = identity1.IsWellKnown();
}
}
if ((message4 == null) || flag1)
{
message4 = new ConstructorCallMessage(null, null, null, this.GetProxiedType());
message4.SetFrame(msgData);
message1 = message4;
if (flag1)
{
proxy1.ConstructorMessage = null;
if (message4.ArgCount != 0)
{
throw new RemotingException(Environment.GetResourceString("Remoting_Activation_WellKnownCTOR"));
}
}
message2 = new ConstructorReturnMessage((MarshalByRefObject) this.GetTransparentProxy(), null, 0, null, message4);
}
else
{
message4.SetFrame(msgData);
message1 = message4;
}
////////////////////////
ChannelServices.IncrementRemoteCalls();

if (message2 == null)
{
LogicalCallContext context1 = null;
Thread thread1 = Thread.CurrentThread;
context1 = thread1.GetLogicalCallContext();
this.SetCallContextInMessage(message1, num1, context1);
context1.PropagateOutgoingHeadersToMessage(message1);
message2 = this.Invoke(message1);
this.ReturnCallContextToThread(thread1, message2, num1, context1);
CallContext.GetLogicalCallContext().PropagateIncomingHeadersToCallContext(message2);
}
RealProxy.HandleReturnMessage(message1, message2);
////////////////////////
MarshalByRefObject obj1 = null;
IConstructionReturnMessage message7 = message2 as IConstructionReturnMessage;
if (message7 == null)
{
throw new RemotingException(Environment.GetResourceString("Remoting_Proxy_BadReturnTypeForActivation"));
}
ConstructorReturnMessage message8 = message7 as ConstructorReturnMessage;
if (message8 != null)
{
obj1 = (MarshalByRefObject) message8.GetObject();
if (obj1 == null)
{
throw new RemotingException(Environment.GetResourceString("Remoting_Activation_NullReturnValue"));
}
}
else
{
obj1 = (MarshalByRefObject) RemotingServices.InternalUnmarshal((ObjRef) message7.ReturnValue, this.GetTransparentProxy(), true);
if (obj1 == null)
{
throw new RemotingException(Environment.GetResourceString("Remoting_Activation_NullFromInternalUnmarshal"));
}
}
if (obj1 != ((MarshalByRefObject) this.GetTransparentProxy()))
{
throw new RemotingException(Environment.GetResourceString("Remoting_Activation_InconsistentState"));
}
if (this.IsRemotingProxy())
{
proxy1.ConstructorMessage = null;
}
////////////////////////
}

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: