Title: Remoting with interface definition

Using the following concept is not working on mono, but in the MS .Net framework:

Common Lib:

intercace IServerObj

{

        string Name { get; }

}

Client:

main()

{

        ChannelServices.RegisterChannel(new TcpChannel(0));

IServerObject server = Activation.GetObject(typeof(IServerObj),"tcp://localhost:8085/Test") as IServerObject;

string name = server.Name;

}

Server:

class ServerObject : MarshalByRefObject, IServerObject

{

        public string Name { get { return "Test Server"; } }

}

main()

{

        ChannelServices.RegisterChannel(new TcpChannel(8085));

        RemotingConfiguration.RegisterWellKnownServiceType(typeof(HelloServer),"Test",WellKnownObjectMode.Singleton);

}

This is a very important concept, since it allows hiding the implementation from the Client.

The crash is in corlib : Remoting.TypeInfo (since it assumes to be derived from object or MarshalByRefObject, which it is not, since it is a pure interface).  Fixing that does not help either since it crashes later than, since it still assumes it has to be a MarshalByRefObject (which it eventually should be since it will become a Proxy [right?]).  I'm not that familiar with the mono remoting implementation, but that seems like a design problem, unless I'm doing something wrong.

- Urs C. Muff

Systems Architect       - Research Lab

Reply via email to