[Mono-bugs] [Bug 54439][Wis] New - Remoting problem sending Object with Inheritance from Linux to WinXP
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 16 Feb 2004 15:56:33 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by gmiyake@carter-inc.com.
http://bugzilla.ximian.com/show_bug.cgi?id=54439
--- shadow/54439 2004-02-16 15:56:33.000000000 -0500
+++ shadow/54439.tmp.7913 2004-02-16 15:56:33.000000000 -0500
@@ -0,0 +1,643 @@
+Bug#: 54439
+Product: Mono/Runtime
+Version: unspecified
+OS:
+OS Details: WIN XP, .NET 1.1, RedHat Linux 3.2.2
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: gmiyake@carter-inc.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Remoting problem sending Object with Inheritance from Linux to WinXP
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+
+If I try to send an object that uses inheritance from a Linux server to a
+WinXP client I get a Serialization Error. This does not happen for
+objects not using inheritance.
+
+I am running RedHat Linux with mono 0.30.1 on the server and WinXP .NET
+1.1 on the client.
+
+Steps to reproduce the problem:
+1. start the server
+2. start the client
+3.
+
+Actual Results:
+Press Enter to start Remoting Client connection to :
+tcp://cuttingedge:8084/Mono
+TestServerApplication
+
+Creating two remote items...
+
+Finished Creating two remote items 1 and 2...
+Creating two client items...
+ServerObject ClientCreatedObject3: setting 333
+ServerObject ClientCreatedObject4: setting 444
+
+Adding client created objects to the server list...
+
+Request the server processing items in the list..
+
+Sending complex data to server...
+ComplexData Content:
+Enum value: d
+Array item: Complex Data From Client
+Array item: 1122
+Array item: Test Data - Hello World
+ComplexData round trip result:
+ComplexData Content:
+Enum value: d
+Array item: Complex Data From Client
+Array item: 1122
+Array item: Test Data - Hello World
+ComplexData from server:
+ComplexData Content:
+Enum value: e
+Array item: Complex Data From Server
+Array item: 112233
+Array item: Goodbye World
+Array item: 1
+Double value received from server: 11.3
+Sending Double value to server: 22.4
+Sending XferObjectSimple data to server...
+Receiving XferObjectSimple from server...
+Receiving XferObject from server...
+###################################
+RemotingClient caught Exception :
+System.Runtime.Serialization.SerializationExce
+ption: Cannot find member name XferTest.Xfer.XferObject.
+
+Server stack trace:
+ at
+System.Runtime.Serialization.Formatters.Binary.ReadObjectInfo.GetMemberTyp
+es(String[] inMemberNames)
+ at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor
+(String obje
+ctName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
+typeInf
+ormationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32
+objectId, Bi
+naryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
+ at System.Runtime.Serialization.Formatters.Binary.ObjectMap.Create
+(String nam
+e, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
+typeInformat
+ionA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId,
+BinaryA
+ssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
+ at
+System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWi
+thMapTyped(BinaryObjectWithMapTyped record)
+ at
+System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWi
+thMapTyped(BinaryHeaderEnum binaryHeaderEnum)
+ at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
+ at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(He
+aderHandler handler, __BinaryParser serParser, Boolean fCheck,
+IMethodCallMessag
+e methodCallMessage)
+ at
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
+(Stream serializationStream, HeaderHandler handler, Boolean fCheck,
+IMethodCallM
+essage methodCallMessage)
+ at
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.UnsafeDeser
+ializeMethodResponse(Stream serializationStream, HeaderHandler handler,
+IMethodC
+allMessage methodCallMessage)
+ at
+System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMess
+age(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
+ at
+System.Runtime.Remoting.Channels.BinaryClientFormatterSink.DeserializeMess
+age(IMethodCallMessage mcm, ITransportHeaders headers, Stream stream)
+ at
+System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMess
+age(IMessage msg)
+
+Exception rethrown at [0]:
+ at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage
+(IMessage req
+Msg, IMessage retMsg)
+ at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke
+(MessageData& msgDa
+ta, Int32 type)
+ at RemotingTest.ServerList.GetTestXferObject() in
+c:\dev\mono\monotest\remoti
+ngobject\remotingobject\remoteobject.cs:line 96
+ at RemotingTest.RemotingClient.Main() in
+c:\dev\mono\monotest\remotingclient\
+remotingclient.cs:line 103
+
+Server stack trace:
+ at
+System.Runtime.Serialization.Formatters.Binary.ReadObjectInfo.GetMemberTyp
+es(String[] inMemberNames)
+ at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor
+(String obje
+ctName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
+typeInf
+ormationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32
+objectId, Bi
+naryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
+ at System.Runtime.Serialization.Formatters.Binary.ObjectMap.Create
+(String nam
+e, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[]
+typeInformat
+ionA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId,
+BinaryA
+ssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
+ at
+System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWi
+thMapTyped(BinaryObjectWithMapTyped record)
+ at
+System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWi
+thMapTyped(BinaryHeaderEnum binaryHeaderEnum)
+ at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
+ at
+System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(He
+aderHandler handler, __BinaryParser serParser, Boolean fCheck,
+IMethodCallMessag
+e methodCallMessage)
+ at
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
+(Stream serializationStream, HeaderHandler handler, Boolean fCheck,
+IMethodCallM
+essage methodCallMessage)
+ at
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.UnsafeDeser
+ializeMethodResponse(Stream serializationStream, HeaderHandler handler,
+IMethodC
+allMessage methodCallMessage)
+ at
+System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMess
+age(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
+ at
+System.Runtime.Remoting.Channels.BinaryClientFormatterSink.DeserializeMess
+age(IMethodCallMessage mcm, ITransportHeaders headers, Stream stream)
+ at
+System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMess
+age(IMessage msg)
+
+Exception rethrown at [0]:
+ at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage
+(IMessage req
+Msg, IMessage retMsg)
+ at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke
+(MessageData& msgDa
+ta, Int32 type)
+ at RemotingTest.ServerList.GetTestXferObject() in
+c:\dev\mono\monotest\remoti
+ngobject\remotingobject\remoteobject.cs:line 96
+ at RemotingTest.RemotingClient.Main() in
+c:\dev\mono\monotest\remotingclient\
+remotingclient.cs:line 103
+###################################
+Done. Press Enter to exit.
+
+
+Expected Results:
+Expected the XferObject object to be transferred between the Linux and
+WinXP platforms the same as the XferObjectSimple class.
+
+How often does this happen?
+
+Always.
+
+Additional Information:
+
+RemotingClient.cs ------------------------------------------------------
+
+using System;
+using System.Net;
+using System.Collections;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using XferTest.Xfer;
+
+
+namespace RemotingTest {
+ class RemotingClient {
+ static void Main () {
+ try {
+ //String remoteObjectName
+= "tcp://localhost:8084/MonoTestServerApplication";
+ String remoteObjectName
+= "tcp://cuttingedge:8084/MonoTestServerApplication";
+ Console.WriteLine("Press Enter to start Remoting Client
+connection to : "
+ + remoteObjectName);
+ Console.ReadLine();
+
+ TcpChannel ch = new TcpChannel(0);
+ ChannelServices.RegisterChannel (ch);
+
+ // This gets the object from the server (a list of ServerObject)
+ MarshalByRefObject oRemoteInterface = (MarshalByRefObject)
+ RemotingServices.Connect(typeof
+(RemotingTest.ServerList),remoteObjectName);
+
+ // cast the remote class to our local interface class
+ ServerList list = oRemoteInterface as ServerList;
+
+
+ // These are remote calls that return references to remote objects
+
+ Console.WriteLine ("Creating two remote items...");
+ ServerObject item1 = list.NewItem ("ServerCreatedObject1");
+ item1.SetValue (111); // another call made to the remote object
+ ServerObject item2 = list.NewItem ("ServerCreatedObject2");
+ item2.SetValue (222);
+ Console.WriteLine ();
+ Console.WriteLine ("Finished Creating two remote items 1 and
+2...");
+ // Two objects created in this client app to send to the server
+
+ Console.WriteLine ("Creating two client items...");
+ ServerObject item3 = new ServerObject ("ClientCreatedObject3");
+ item3.SetValue (333);
+ ServerObject item4 = new ServerObject ("ClientCreatedObject4");
+ item4.SetValue (444);
+ Console.WriteLine ();
+
+ // Object references passed to the remote list
+
+ Console.WriteLine ("Adding client created objects to the server
+list...");
+ list.Add (item3);
+ list.Add (item4);
+ Console.WriteLine ();
+
+ // This sums all values of the ServerObjects in the list. The
+ // server
+ // makes a remote call to this client to get the value of the
+ // objects created locally
+
+ Console.WriteLine ("Request the server processing items in the
+list..");
+ list.ProcessItems ();
+ Console.WriteLine ();
+
+ // Passing some complex info as parameter and return value
+
+ Console.WriteLine ("Sending complex data to server...");
+ ComplexData cd = new ComplexData (AnEnum.d, new object[] {
+ "Comple
+x Data From Client",1122,"Test Data - Hello World"});
+ cd.Dump();
+ ComplexData res = list.SetComplexData (cd);
+ Console.WriteLine ("ComplexData round trip result:");
+ res.Dump();
+ res = list.GetComplexData();
+ Console.WriteLine ("ComplexData from server:");
+ res.Dump();
+
+ double dVal = list.GetDouble();
+ Console.WriteLine ("Double value received from server: " + dVal);
+ dVal = 22.4;
+ Console.WriteLine ("Sending Double value to server: " + dVal);
+ list.SetDouble(dVal);
+
+ Console.WriteLine ("Sending XferObjectSimple data to server...");
+ XferObjectSimple sObj = new XferObjectSimple(10);
+ list.SetTestXferObjectSimple(sObj);
+ Console.WriteLine ("Receiving XferObjectSimple from server...");
+ sObj = list.GetTestXferObjectSimple();
+
+ Console.WriteLine ("Receiving XferObject from server...");
+ XferObject bObj = list.GetTestXferObject();
+
+ Console.WriteLine ("Sending XferObject data to server...");
+ XferObject aObj = new XferObject(10);
+ list.SetTestXferObject(aObj);
+
+ Console.WriteLine ("Clearing List on server :");
+ list.Clear();
+
+ ch.StopListening (null);
+ }
+ catch (Exception exc) {
+ Console.WriteLine("###################################");
+ Console.WriteLine("RemotingClient caught Exception : " + exc);
+ Console.WriteLine(exc.StackTrace);
+ Console.WriteLine("###################################");
+ }
+ finally {
+ Console.WriteLine ("Done. Press Enter to exit.");
+ Console.ReadLine();
+ }
+ }
+ }
+}
+
+RemotingServer.cs ------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using System.Runtime.Remoting.Channels.Http;
+
+namespace RemotingTest {
+ class RemotingServer {
+ static int Main () {
+ int port = 8084;
+ String remoteServiceName = "MonoTestServerApplication";
+ Console.WriteLine("Press Enter to start Remoting Server on
+port: " + port +
+ ", service : " + remoteServiceName);
+ Console.ReadLine();
+ Console.WriteLine("Starting Server...");
+ // Remoting stuff here ---------------------------------
+ //
+ //
+ BinaryServerFormatterSinkProvider provider = new
+BinaryServerFormatterSinkProvider();
+ provider.TypeFilterLevel =
+System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
+ BinaryClientFormatterSinkProvider clientProv = new
+BinaryClientFormatterSinkProvider();
+ IDictionary props = new Hashtable();
+ props["port"] = port;
+ TcpChannel channel = null;
+ channel = new TcpChannel(props, clientProv, provider);
+
+ ChannelServices.RegisterChannel (channel);
+
+
+ Type serverType = typeof(RemotingTest.ServerList);
+
+ RemotingConfiguration.RegisterWellKnownServiceType
+ (serverType, remoteServiceName,
+WellKnownObjectMode.Singleton);
+ // ---------------------------------
+ Console.WriteLine("Server Running ...");
+ Console.WriteLine("Press Enter to Stop Remoting Server...");
+ Console.ReadLine();
+ channel.StopListening (null);
+
+ return 0;
+ }
+ }
+}
+
+RemoteObject.cs ----------------------------------------------------------
+
+using System;
+using System.Runtime.Remoting;
+using System.Collections;
+using XferTest.Xfer;
+
+namespace RemotingTest {
+ // A list of ServerObject instances
+
+
+ public class ServerList: MarshalByRefObject {
+ static int n_instances;
+ static int numCalls = 0;
+ public ServerList() {
+ n_instances++;
+ Console.WriteLine("");
+ Console.WriteLine("ServerList activated - instance # {0}.",
+n_instances);
+ }
+ ~ServerList() {
+ Console.WriteLine("ServerList instance {0} destroyed.",
+n_instances);
+ n_instances--;
+ }
+
+ ArrayList values = new ArrayList();
+
+ public void Add (ServerObject v) {
+ values.Add (v);
+
+ System.Console.WriteLine ("ServerList - Added " + v.Name);
+ }
+
+ public void ProcessItems () {
+ Console.WriteLine ("ServerList - Processing...");
+
+ int index = 0;
+ try {
+ foreach (ServerObject ob in values)
+ Console.WriteLine ("ServerList[" + index++ + "] : " + ob.Name);
+ } catch (Exception exc){
+ Console.WriteLine("Server Exception while processing list" + exc);
+ Console.WriteLine(exc.StackTrace);
+ }
+ }
+
+ public void Clear() {
+ Console.WriteLine ("ServerList - clearing object list");
+ values.Clear();
+ }
+
+ public ServerObject NewItem(string name) {
+ ServerObject obj = new ServerObject(name);
+ Add (obj);
+ Console.WriteLine ("ServerList - created NewItem: " + name);
+ return obj;
+ }
+
+ public ComplexData SetComplexData (ComplexData data) {
+ Console.WriteLine ("ComplexData received by server");
+ data.Dump ();
+ return data;
+ }
+
+ public ComplexData GetComplexData () {
+ ComplexData cd = new ComplexData (AnEnum.e, new object[] {
+ "Complex
+Data From Server",112233,"Goodbye World", ++numCalls});
+ Console.WriteLine ("Server created ComplexData");
+ cd.Dump();
+ return cd;
+ }
+
+ public void SetDouble(double pDouble) {
+ Console.WriteLine("SetDouble value received: " + pDouble);
+ }
+
+ public double GetDouble() {
+ double value = 11.3;
+ Console.WriteLine("Returning double: " + value);
+ return value;
+ }
+
+ public void SetTestXferObjectSimple(XferObjectSimple xObject){
+ Console.WriteLine("XferObjectSimple received from client" );
+ }
+
+ public XferObjectSimple GetTestXferObjectSimple() {
+ Console.WriteLine ("XferObjectSimple requested by client");
+ XferObjectSimple aObject = new XferObjectSimple(11);
+ return aObject;
+ }
+
+ public void SetTestXferObject(XferObject xObject){
+ Console.WriteLine("XferObject received from client" );
+ }
+
+ public XferObject GetTestXferObject() {
+ Console.WriteLine ("XferBlock requested by client");
+ XferObject aObject = new XferObject(11);
+ return aObject;
+ }
+ }
+ // A remotable object
+
+ public class ServerObject: MarshalByRefObject {
+ int _value;
+ string _name;
+
+ public ServerObject (string name) {
+ _name = name;
+ }
+
+ public string Name {
+ get { return _name; }
+ }
+
+ public void SetValue (int v) {
+ Console.WriteLine ("ServerObject " + _name + ": setting " + v);
+ _value = v;
+ }
+
+ public int GetValue () {
+ Console.WriteLine ("ServerObject " + _name + ": getting " + _value);
+ return _value;
+ }
+ }
+
+ // Some complex data for testing serialization
+
+ public enum AnEnum { a,b,c,d,e };
+
+ [Serializable]
+ public class ComplexData {
+ public AnEnum Val = AnEnum.a;
+ public object[] Info;
+
+ public ComplexData (AnEnum va, object[] info) {
+ Info = info;
+ Val = va;
+ }
+
+ public void Dump () {
+ System.Console.WriteLine ("ComplexData Content:");
+ System.Console.WriteLine ("Enum value: " + Val);
+ foreach (object ob in Info)
+ System.Console.WriteLine ("Array item: " + ob);
+ }
+
+ }
+}
+
+Objects transferred...
+XferObjectBase.cs --------------------------------------------------------
+(The Base classs for the XferObject.)
+
+using System;
+//using System.Runtime.Serialization;
+namespace XferTest.Xfer
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ [Serializable]
+ public class XferObjectBase //: ISerializable
+ {
+ private long myXferSequenceNumber = -1;
+ public XferObjectBase()
+ {
+ }
+ public long XferSequenceNumber {
+ get { return myXferSequenceNumber; }
+ set { myXferSequenceNumber = value; }
+ }
+
+ }
+}
+
+XferObject.cs ----------------------------------------------------------
+(This class has serialization problems being sent.)
+
+using System;
+//using System.Runtime.Serialization;
+
+namespace XferTest.Xfer {
+ public enum BLOCK_STATE {
+ AVAILABLE,
+ FILLING,
+ QUEUED_FOR_XFER,
+ TRANSFERING,
+ QUEUED_ON_CLIENT,
+ CLIENT_PROCESSING,
+ OWNED_BY_APP,
+ DISPOSED
+ }
+ [Serializable]
+ public class XferObject : XferObjectBase //, ISerializable
+ {
+ public XferObject( int pNumRows) {
+ myNumRows = pNumRows;
+ myLastUsedIndex = myNumRows;
+ }
+ public XferObject() {
+ myNumRows = 0;
+ myLastUsedIndex = myNumRows;
+ }
+ public int myNumRows;
+ public int myLastUsedIndex;
+
+ }
+}
+
+XferObjectSimple.cs ------------------------------------------------------
+(This object is sent back and forth OK.)
+
+using System;
+
+namespace XferTest.Xfer
+{
+ public enum OBJECT_STATE {
+ AVAILABLE,
+ FILLING,
+ QUEUED_FOR_XFER,
+ TRANSFERING,
+ QUEUED_ON_CLIENT,
+ CLIENT_PROCESSING,
+ OWNED_BY_APP,
+ DISPOSED
+ }
+ /// <summary>
+ /// Summary description for XferObjectSimple.
+ /// </summary>
+ [Serializable]
+ public class XferObjectSimple
+ {
+ public XferObjectSimple(int pNumRows)
+ {
+ myNumRows = pNumRows;
+ myLastUsedIndex = myNumRows;
+ }
+ public int myNumRows;
+ public int myLastUsedIndex;
+ public OBJECT_STATE myState;
+ }
+}