public static IMessage Activate (RemotingProxy proxy, ConstructionCall ctorCall)
{
IMessage response;
+ ctorCall.SourceProxy = proxy;
if (Thread.CurrentContext.HasExitSinks && !ctorCall.IsContextOk)
response = Thread.CurrentContext.GetClientContextSinkChain ().SyncProcessMessage (ctorCall);
else
response = RemoteActivate (ctorCall);
- if (response is IConstructionReturnMessage && ((IConstructionReturnMessage)response).Exception == null)
+ if (response is IConstructionReturnMessage && ((IConstructionReturnMessage)response).Exception == null && proxy.ObjectIdentity == null)
{
Identity identity = RemotingServices.GetMessageTargetIdentity (ctorCall);
proxy.AttachIdentity (identity);
public static IMessage CreateInstanceFromMessage (IConstructionCallMessage ctorCall)
{
object obj = AllocateUninitializedClassInstance (ctorCall.ActivationType);
- ctorCall.MethodBase.Invoke (obj, ctorCall.Args);
ServerIdentity identity = (ServerIdentity) RemotingServices.GetMessageTargetIdentity (ctorCall);
-
identity.AttachServerObject ((MarshalByRefObject) obj, Threading.Thread.CurrentContext);
+ ConstructionCall call = ctorCall as ConstructionCall;
+ if (ctorCall.ActivationType.IsContextful && call != null && call.SourceProxy != null)
+ {
+ call.SourceProxy.AttachIdentity (identity);
+ MarshalByRefObject target = (MarshalByRefObject) call.SourceProxy.GetTransparentProxy ();
+ RemotingServices.InternalExecuteMessage (target, ctorCall);
+ }
+ else
+ ctorCall.MethodBase.Invoke (obj, ctorCall.Args);
+
return new ConstructionResponse (obj, null, ctorCall);
}
+2004-09-22 Lluis Sanchez Gual <lluis@novell.com>
+
+ * ActivationServices.cs: In Activate, assign the proxy to the ctor
+ message. In CreateInstanceFromMessage if the object being created
+ is a CBO, use the provided proxy as "this" when calling the ctor.
+
2003-12-23 Lluis Sanchez Gual <lluis@ximian.com>
* ActivationServices.cs: If remote activation returns an exception, do not