locked
Internals of remote object creation RRS feed

  • Question

  • Hi all,

    When you have a code segment like the following:

    ChannelServices.RegisterChannel(new TcpClientChannel());
    RemotingConfiguration.RegisterWellKnownClientType(typeof(TransactionMaintenance), "tcp://localhost:1235/TransactionMaintenance");
    this.transactionMaintenance = new TransactionMaintenance();

    I wasn't able to find a link between the type registration and the object
    instantiation.
    If you inspect the IL for this code the object instantiation is done with a
    newobj opcode just as would have been done for a local object.
    How does the CLR know that it should instantiate a remote class instead of a
    local one?

    Thanks in advance.

    Alfred Gary Myers Jr.
    http://www.yuma.com.br
    http://br.thespoke.net/MyBlog/alfred_myers/MyBlog.aspx
    Friday, June 3, 2005 7:34 PM

Answers

  • Magic. Smile

    I think that Don's book covers this, but if you want the real inside scoop go download the Rotor source and take a look.

    The short answer is that the CLR knows what types are registered for remote activation and acts according.
    Thursday, July 14, 2005 12:23 AM
    Moderator

All replies

  • Magic. Smile

    I think that Don's book covers this, but if you want the real inside scoop go download the Rotor source and take a look.

    The short answer is that the CLR knows what types are registered for remote activation and acts according.
    Thursday, July 14, 2005 12:23 AM
    Moderator
  • Hello Doug,

    If my memory is refreshed, Is this "magic" happens in accordance with CLR, correctly? At remote object registration, can this "magic" change some internals (http://msdn.microsoft.com/msdnmag/issues/05/05/JITCompiler/default.aspx) of MethodTable to redirect to remote proxy ? I think this is an obvious way to work transparently with IL Opcode like newobj (ok, I look at some internals in Rotor too)...

    Thanks
    Thursday, July 28, 2005 2:48 PM