2008-09-04 Robert Jordan <robertj@gmx.net>
authorRobert Jordan <robertj@gmx.net>
Wed, 17 Sep 2008 11:28:51 +0000 (11:28 -0000)
committerRobert Jordan <robertj@gmx.net>
Wed, 17 Sep 2008 11:28:51 +0000 (11:28 -0000)
* corlib_test.dll: Add S.R.S/SerializationTest2.cs

In System.Runtime.Serialization.Formatters.Binary:
2008-09-17  Robert Jordan  <robertj@gmx.net>>

* ObjectReader.cs (ReadTypeMetadata): Replace the check for
ISerializable with something less `reflective'.
Fixes #421664.

In Test/System.Runtime.Serialization:
2008-09-17  Robert Jordan  <robertj@gmx.net>

* SerializationTest2.cs: Add test case for bug #421664.

svn path=/trunk/mcs/; revision=113278

mcs/class/corlib/ChangeLog
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ChangeLog
mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
mcs/class/corlib/Test/System.Runtime.Serialization/ChangeLog
mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest2.cs [new file with mode: 0644]
mcs/class/corlib/corlib_test.dll.sources

index 73b59270537981c556e2a67bc8ddfdad59e913d7..dee16ae258a8b360fd7ed2bb4c8bbe533e3c77c5 100644 (file)
@@ -1,3 +1,7 @@
+2008-09-04  Robert Jordan  <robertj@gmx.net>
+
+       * corlib_test.dll: Add S.R.S/SerializationTest2.cs
+
 2008-08-27  Marek Safar  <marek.safar@gmail.com>
 
        * Makefile: Removed disabled global 649 warning.
index 814a129999b614e6aa1b5962dbab232cc66e1800..1353b32cc924f32ed89a51c089eb07a77cbf4568 100644 (file)
@@ -1,3 +1,9 @@
+2008-09-17  Robert Jordan  <robertj@gmx.net>>
+
+       * ObjectReader.cs (ReadTypeMetadata): Replace the check for
+       ISerializable with something less `reflective'.
+       Fixes #421664.
+
 2008-06-27  Andreas Nahr <ClassDevelopment@A-SoftTech.com>
 
        * BinaryFormatter.cs: Fix parameter name
index 25d5ba2512db27e7e7665048742d0ddbb7c667c9..5e90a40acbe224da8bd5542e98796c884042f856 100644 (file)
@@ -632,7 +632,7 @@ namespace System.Runtime.Serialization.Formatters.Binary
                                if (!metadata.Type.IsSerializable)
                                        throw new SerializationException("Serializable objects must be marked with the Serializable attribute");
 
-                               metadata.NeedsSerializationInfo = (metadata.Type.GetInterface ("ISerializable") != null);
+                               metadata.NeedsSerializationInfo = typeof (ISerializable).IsAssignableFrom (metadata.Type);
                                if (!metadata.NeedsSerializationInfo)
                                {
                                        metadata.MemberInfos = new MemberInfo [fieldCount];
index 5bf1e5623b8e38be85a9ee9f292e65bd20fc2c1f..b660b1cbcf92b567a004d489878fbe6c4762cd33 100644 (file)
@@ -1,57 +1,61 @@
-2006-10-29  Robert Jordan  <robertj@gmx.net>\r
-\r
-       * SerializationCallbackTest.cs: Add test case for bug #78594.\r
-\r
-2005-12-21  Raja R Harinath  <rharinath@novell.com>\r
-\r
-       * SerializationTest.cs: Use Assert.AreEqual instead of\r
-       Assertion.AssertEquals.\r
-       (ReadData): Fix order of 'expected' and 'actual' when validating\r
-       'list'.\r
-       (*.CheckEqual): Add new 'context' argument.  Encodes the path\r
-       taken to get to th current object.\r
-\r
-2005-12-15  Gert Driesen  <drieseng@users.sourceforge.net>\r
-\r
-       * ObjectManagerTest.cs: New test for bug #76931.\r
-\r
-2005-03-23  Lluis Sanchez Gual  <lluis@ximian.com>\r
-\r
-       * ArraySerializationTest.cs: New serialization tests.\r
-\r
-2005-03-04  Lluis Sanchez Gual <lluis@novell.com>\r
-\r
-       * SerializationTest.cs: Improved test.\r
-\r
-2004-12-09  Lluis Sanchez Gual  <lluis@ximian.com>\r
-\r
-       * SerializationTest.cs: Added test for bug #70104.\r
-\r
-2004-05-13  Lluis Sanchez Gual  <lluis@ximian.com>\r
-\r
-       * SerializationTest.cs: Test serialization of empty struct arrays. This\r
-         used to fail.\r
-\r
-2003-07-23  Lluis Sanchez Gual  <lluis@ximian.com>\r
-\r
-       * SerializationTest.cs: Fixed delegate invocation. Didn't compile\r
-         on windows.\r
-\r
-2003-07-23  Lluis Sanchez Gual  <lluis@ximian.com>\r
-\r
-       * SerializationTest.cs: Added.\r
-\r
-2002-12-21  Nick Drochak <ndrochak@gol.com>\r
-\r
-       * all: make tests build and run under nunit2\r
-\r
-2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>\r
-\r
-       * AllTests.cs: added FormatterServicesTests.\r
-       * FormatterServicesTests.cs: New file.\r
-\r
-2002-06-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>\r
-\r
-       * AllTests.cs: New file to make 'make test' work.\r
-       * ChangeLog: New file.\r
-\r
+2008-09-17  Robert Jordan  <robertj@gmx.net>
+
+       * SerializationTest2.cs: Add test case for bug #421664.
+
+2006-10-29  Robert Jordan  <robertj@gmx.net>
+
+       * SerializationCallbackTest.cs: Add test case for bug #78594.
+
+2005-12-21  Raja R Harinath  <rharinath@novell.com>
+
+       * SerializationTest.cs: Use Assert.AreEqual instead of
+       Assertion.AssertEquals.
+       (ReadData): Fix order of 'expected' and 'actual' when validating
+       'list'.
+       (*.CheckEqual): Add new 'context' argument.  Encodes the path
+       taken to get to th current object.
+
+2005-12-15  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * ObjectManagerTest.cs: New test for bug #76931.
+
+2005-03-23  Lluis Sanchez Gual  <lluis@ximian.com>
+
+       * ArraySerializationTest.cs: New serialization tests.
+
+2005-03-04  Lluis Sanchez Gual <lluis@novell.com>
+
+       * SerializationTest.cs: Improved test.
+
+2004-12-09  Lluis Sanchez Gual  <lluis@ximian.com>
+
+       * SerializationTest.cs: Added test for bug #70104.
+
+2004-05-13  Lluis Sanchez Gual  <lluis@ximian.com>
+
+       * SerializationTest.cs: Test serialization of empty struct arrays. This
+         used to fail.
+
+2003-07-23  Lluis Sanchez Gual  <lluis@ximian.com>
+
+       * SerializationTest.cs: Fixed delegate invocation. Didn't compile
+         on windows.
+
+2003-07-23  Lluis Sanchez Gual  <lluis@ximian.com>
+
+       * SerializationTest.cs: Added.
+
+2002-12-21  Nick Drochak <ndrochak@gol.com>
+
+       * all: make tests build and run under nunit2
+
+2002-08-20  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * AllTests.cs: added FormatterServicesTests.
+       * FormatterServicesTests.cs: New file.
+
+2002-06-24  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * AllTests.cs: New file to make 'make test' work.
+       * ChangeLog: New file.
+
diff --git a/mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest2.cs b/mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest2.cs
new file mode 100644 (file)
index 0000000..897dcb4
--- /dev/null
@@ -0,0 +1,61 @@
+//
+// System.Runtime.Serialization.SerializationTest2.cs
+//
+// Test case for bug #421664.
+//
+// Author: Robert Jordan  <robertj@gmx.net>
+//
+// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+using NUnit.Framework;
+
+// We need a different namespace because we pollute it with
+// a new ISerializable declaration.
+namespace MonoTests.System.Runtime.Serialization2
+{
+       public interface ISerializable
+       {
+       }
+
+       [Serializable]
+       public class Class : ISerializable
+       {
+       }
+
+       [TestFixture]
+       public class SerializationTest2
+       {
+               [Test]
+               public void TestSerialization ()
+               {
+                       MemoryStream ms = new MemoryStream ();
+
+                       new BinaryFormatter ().Serialize (ms, new Class ());
+                       ms.Position = 0;
+                       new BinaryFormatter ().Deserialize (ms);
+               }
+       }
+}
index a1c6461485d07d521c9eba559658ab9f6f1080a0..bc906cf72281c3a82f8991b0d0ccc49b5f17cf46 100644 (file)
@@ -166,6 +166,7 @@ System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinaryTest.cs
 System.Runtime.Serialization/FormatterServicesTests.cs
 System.Runtime.Serialization/ObjectIDGeneratorTests.cs
 System.Runtime.Serialization/SerializationTest.cs
+System.Runtime.Serialization/SerializationTest2.cs
 System.Runtime.Serialization/SerializationCallbackTest.cs
 System.Runtime.Serialization/ArraySerializationTest.cs
 System.Runtime.Serialization/ObjectManagerTest.cs