RealProxy.InitializeServerObject Method (IConstructionCallMessage)


Initializes a new instance of the object Type of the remote object that the current instance of RealProxy represents with the specified IConstructionCallMessage.

Namespace:   System.Runtime.Remoting.Proxies
Assembly:  mscorlib (in mscorlib.dll)

public IConstructionReturnMessage InitializeServerObject(
	IConstructionCallMessage ctorMsg


Type: System.Runtime.Remoting.Activation.IConstructionCallMessage

A construction call message that contains the constructor parameters for the new instance of the remote object that is represented by the current RealProxy. Can be null.

Return Value

Type: System.Runtime.Remoting.Activation.IConstructionReturnMessage

The result of the construction request.

Exception Condition

The immediate caller does not have UnmanagedCode permission.

If the ctorMsg parameter is null, then the InitializeServerObject method calls the default constructor for the new instance of the remote object that is represented by the current RealProxy.

public override IMessage Invoke(IMessage myMessage)
   Console.WriteLine("MyProxy 'Invoke method' Called...");
   if (myMessage is IMethodCallMessage)
   if (myMessage is IMethodReturnMessage)
   if (myMessage is IConstructionCallMessage)
      // Initialize a new instance of remote object
      IConstructionReturnMessage myIConstructionReturnMessage = 
      ConstructionResponse constructionResponse = new 
         ConstructionResponse(null,(IMethodCallMessage) myMessage);
      return constructionResponse;
   IDictionary myIDictionary = myMessage.Properties;
   IMessage returnMessage;
   myIDictionary["__Uri"] = myUri;

   // Synchronously dispatch messages to server.
   returnMessage = ChannelServices.SyncDispatchMessage(myMessage);
   // Pushing return value and OUT parameters back onto stack.
   IMethodReturnMessage myMethodReturnMessage = (IMethodReturnMessage)returnMessage;
   return returnMessage;


For the ability to call unmanaged code. Demand value: SecurityAction.LinkDemand; Permission value: SecurityPermissionFlag.UnmanagedCode

.NET Framework
Available since 1.1
Return to top