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;
}
////////////////////////
}