[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, 27 Oct 2004 08:54:36 -0400 (EDT)


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 vavrik@teledom.sk.

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

--- shadow/68831	2004-10-27 08:25:34.000000000 -0400
+++ shadow/68831.tmp.21386	2004-10-27 08:54:35.000000000 -0400
@@ -48,6 +48,80 @@
 
 Additional Information:
 
 ------- Additional Comments From lluis@ximian.com  2004-10-27 08:25 -------
 I can't reproduce this error. Can you please attach a simple test case
 that fails for you? (a simpe console application all I need).
+
+------- Additional Comments From vavrik@teledom.sk  2004-10-27 08:54 -------
+here is my test code for you
+
+//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;
+		}
+	}
+}
+
+//this is void to test in your test class
+
+public void Test(){
+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);
+
+
+//result after deserialize, but dsata in stream are ok. MS deserialize
+data from mono correctly 
+
+//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
+}