[Mono-bugs] [Bug 68831][Nor] Changed - can't deserialize class and class derivered from this class and with reference

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 3 Nov 2004 07:07:48 -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 lluis@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=68831

--- shadow/68831	2004-10-27 08:54:35.000000000 -0400
+++ shadow/68831.tmp.26316	2004-11-03 07:07:48.000000000 -0500
@@ -122,6 +122,90 @@
 
 //An unhandled exception of type
 'System.Runtime.Serialization.SerializationException' occurred in j4o.exe
 //Additional information: Field "person+person+meno" not found in
 class Person.person2
 }
+
+------- Additional Comments From lluis@ximian.com  2004-11-03 07:07 -------
+I still can't reproduce the bug. Please, always provide standalone
+tests and detailed instructions about the steps for reproducing the
+issue. It is the only way to make sure that we are testing the same.
+
+I've compiled and executed the following application in Mono and I got
+no exceptions:
+
+using System;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+
+//class for test
+[Serializable]
+public class person2 : person  //here start of  problem
+{
+    public person2()
+	{
+	}
+	
+	public string jajaja = "17";
+}
+	
+[Serializable]
+public class person 
+{
+	public person2 per2;    // here i use derived object
+	public string Name;
+	public string Surname;
+	string meno;
+	public string priezvisko;
+	
+	public person(){
+	}
+
+	public person(string meno, string priezvisko){
+		this.Name = meno;
+		this.Surname = priezvisko;
+	}
+
+	public string Meno{
+        	get	{
+			return meno;
+		}
+		set	{
+			meno = value;
+		}
+	}
+}
+
+public class Test
+{
+	public static void Main ()
+	{
+		MemoryStream ms = new MemoryStream();
+					
+		BinaryFormatter formatter = new BinaryFormatter();
+					
+		person _person = new person();
+		
+		_person = new person();
+		_person.Name = "david";
+		_person.Surname = "termits";
+		_person.Meno = "milan";
+		
+		person2 _person2 = new person2();
+					
+		_person.per2 = _person2;
+		
+		formatter.Serialize(ms, _person);
+		
+		ms.Position = 0;
+		
+		person _personresult = (person)formatter.Deserialize(ms);
+		Console.WriteLine (_personresult.Name);
+		Console.WriteLine (_personresult.Surname);
+		Console.WriteLine (_personresult.Meno);
+		Console.WriteLine (_personresult.per2.jajaja);
+	}
+}	
+
+
+