Here is a reply that I have received from Microsoft.  This approach will
not allow the client to use the new syntax when instantiating the remote
object.

Attaching the modifed sample that works with RemoteTest_Meta.dll  stub in
the client.

Create the stub as below in RemoteTest_Meta.dll

namespace Server
{
             [Serializable]
             public enum DayOfWeek
             {
                  Sunday = 0,
                  Monday = 1,
                  Tuesday = 2,
                  Wednesday = 3,
                  Thursday = 4,
                  Friday = 5,
                  Saturday = 6
             };

         public interface IRemoteTest
         {


                  string doSomething();
                  string doSomething(DayOfWeek weekday);

         }
}



Reference RemoteTest_Meta.dll in both  Client as well as  RemoteTest.dll

Your RemoteTest looks like below.

 public class RemoteTest :MarshalByRefObject, Server.IRemoteTest
 {
      public RemoteTest()
      {
      }

      public string doSomething()
      {
         Console.WriteLine("doSomething() called");
         return "someValue";
      }

      public string doSomething(DayOfWeek weekday)
      {
         Console.WriteLine("doSomething(DayOfWeek) called");
         return Enum.GetName(typeof(DayOfWeek), weekday);
      }

}


Now in the Client  create the object using
         TcpChannel chnl = new TcpChannel();
         ChannelServices.RegisterChannel(chnl);

         Console.WriteLine("Client.Main(): creating rem. reference");
         IRemoteTest server = (IRemoteTest) Activator.GetObject(
typeof(IRemoteTest),
            "tcp://localhost:1234/RemoteTest.rem");



thanks,
liju, Microsoft.


In addition to the above solution, I have found that if you create a
separate satellite assembly containing only the enumerations that is
referenced by both the Server Remote object and the client, then the
method call succeeds.

Matthew

Reply via email to