Merge pull request #3106 from lambdageek/dev/monoerror-unhandled
authorAleksey Kliger (λgeek) <akliger@gmail.com>
Mon, 13 Jun 2016 15:52:35 +0000 (11:52 -0400)
committerGitHub <noreply@github.com>
Mon, 13 Jun 2016 15:52:35 +0000 (11:52 -0400)
[runtime] Okay to raise MonoError in thread start functions.

109 files changed:
Makefile.am
configure.ac
external/ikvm
mcs/class/Mono.CSharp/Test/Evaluator/ExpressionsTest.cs
mcs/class/Mono.Security.Win32/Test/Mono.Security.Cryptography/MD2Test.cs
mcs/class/Mono.Security.Win32/Test/Mono.Security.Cryptography/MD4Test.cs
mcs/class/Mono.Security.Win32/Test/Mono.Security.Cryptography/MD5Test.cs
mcs/class/Mono.Security.Win32/Test/Mono.Security.Cryptography/SHA1Test.cs
mcs/class/Mono.Security/Test/Mono.Math/BigIntegerSetTest.cs
mcs/class/Mono.Security/Test/Mono.Math/PrimeTestingTest.cs
mcs/class/Mono.Security/Test/Mono.Math/SearchGeneratorTest.cs
mcs/class/Mono.Security/Test/Mono.Security.Authenticode/PrivateKeyTest.cs
mcs/class/Mono.Security/Test/Mono.Security.Cryptography/CryptoConvertTest.cs
mcs/class/Mono.Security/Test/Mono.Security.Cryptography/DiffieHellmanManagedTest.cs
mcs/class/Mono.Security/Test/Mono.Security.Cryptography/PKCS8Test.cs
mcs/class/Mono.Security/Test/Mono.Security.Protocol.Ntlm/ChallengeResponseTest.cs
mcs/class/Mono.Security/Test/Mono.Security.Protocol.Ntlm/MessageBaseTest.cs
mcs/class/Mono.Security/Test/Mono.Security.Protocol.Ntlm/Type1MessageTest.cs
mcs/class/Mono.Security/Test/Mono.Security.Protocol.Ntlm/Type2MessageTest.cs
mcs/class/Mono.Security/Test/Mono.Security.Protocol.Ntlm/Type3MessageTest.cs
mcs/class/Mono.Security/Test/Mono.Security/StrongNameTest.cs
mcs/class/System.Data/Test/System.Data/ConstraintCollectionTest2.cs
mcs/class/System.Data/Test/System.Data/DataRowTest.cs
mcs/class/System.Data/Test/System.Data/DataRowViewTest.cs
mcs/class/System.Data/Test/System.Data/DataTableCollectionTest.cs
mcs/class/System.Data/Test/System.Data/DataViewManagerTest.cs
mcs/class/System.Data/Test/System.Data/DataViewTest.cs
mcs/class/System.Data/Test/System.Data/ForeignKeyConstraintTest.cs
mcs/class/System.Data/Test/System.Xml/XmlDataDocumentTest2.cs
mcs/class/System.Net.Http/CFNetworkHandler.cs
mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/InternalSoapValuesTest.cs
mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/SerializationTest.cs
mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/SoapFormatterTest.cs
mcs/class/System/Mono.Net.Security/MonoSslStreamImpl.cs
mcs/class/System/System.Net.Sockets/Socket.cs
mcs/class/System/Test/System.ComponentModel.Design.Serialization/InstanceDescriptorTest.cs
mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs
mcs/class/System/Test/System.Net/HttpListener2Test.cs
mcs/class/System/Test/System.Net/HttpListenerRequestTest.cs
mcs/class/System/Test/System.Net/ServicePointTest.cs
mcs/class/System/Test/System/UriTest.cs
mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
mcs/class/corlib/System/Environment.cs
mcs/class/corlib/System/TimeZoneInfo.cs
mcs/class/corlib/Test/Mono.Math/ArithmeticBigTest.cs
mcs/class/corlib/Test/Mono.Math/PrimeTestingTest.cs
mcs/class/corlib/Test/System.Collections/SortedListTest.cs
mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs
mcs/class/corlib/Test/System/ConvertTest.cs
mcs/class/corlib/Test/System/EnvironmentTest.cs
mcs/class/corlib/Test/System/TimeZoneInfoTest.cs
mcs/class/corlib/Test/System/TimeZoneTest.cs
mcs/class/doc/NUnitGuidelines
mcs/class/referencesource/System/net/System/Net/WebHeaderCollection.cs
mcs/class/referencesource/System/net/System/URI.cs
mcs/mcs/convert.cs
mcs/mcs/import.cs
mcs/mcs/mcs.csproj
mcs/tests/test-936-lib.il [new file with mode: 0644]
mcs/tests/test-936.cs [new file with mode: 0644]
mcs/tests/test-interpolation-10.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml
mcs/tools/linker/Descriptors/mscorlib.xml
mono/io-layer/sockets.c
mono/metadata/.gitignore
mono/metadata/Makefile.am
mono/metadata/appdomain.c
mono/metadata/coree.c
mono/metadata/icall-def.h
mono/metadata/icall.c
mono/metadata/image.c
mono/metadata/marshal.c
mono/metadata/metadata-internals.h
mono/metadata/monitor.c
mono/metadata/object-internals.h
mono/metadata/object.c
mono/metadata/opcodes.h
mono/metadata/pedump.c [deleted file]
mono/metadata/sgen-mono.c
mono/metadata/socket-io.c
mono/metadata/socket-io.h
mono/mini/driver.c
mono/mini/method-to-ir.c
mono/mini/mini-amd64.c
mono/mini/mini-amd64.h
mono/mini/mini-codegen.c
mono/mini/mini-llvm.c
mono/mini/mini-ops.h
mono/mini/mini-runtime.c
mono/mini/mini.c
mono/mini/mini.h
mono/sgen/sgen-alloc.c
mono/sgen/sgen-gc.c
mono/sgen/sgen-gc.h
mono/sgen/sgen-marksweep.c
mono/tests/Makefile.am
mono/tests/libtest.c
mono/tests/sleep.cs
mono/tests/test-runner.cs
mono/tests/tests-config.in
mono/utils/mono-hwcap-arm.c
scripts/ci/run-jenkins.sh
tools/Makefile.am
tools/monograph/Makefile.am
tools/pedump/.gitignore [new file with mode: 0644]
tools/pedump/Makefile.am [new file with mode: 0644]
tools/pedump/pedump.c [new file with mode: 0644]
tools/sgen/Makefile.am
tools/sgen/gcpausevis.py

index c0672460ea05b19b410a140f5790651cafd6b6cf..0df27c54ea9ac0be3b5023c420a82d99923603fc 100644 (file)
@@ -4,17 +4,16 @@ AM_CFLAGS = $(WERROR_CFLAGS)
 
 MONOTOUCH_SUBDIRS = $(libgc_dir) eglib/src mono
 
+# Some tools might not build when cross-compiling
 if CROSS_COMPILING
-SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples msvc $(docs_dir) acceptance-tests llvm
-# Keep in sync with SUBDIRS
-## 'tools' is not normally built
-DIST_SUBDIRS = m4 po $(libgc_dir) eglib mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
+tools_dir =
 else
-SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples msvc $(docs_dir) acceptance-tests llvm
+tools_dir = tools
+endif
+
+SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
 # Keep in sync with SUBDIRS
-## 'tools' is not normally built
 DIST_SUBDIRS = m4 po $(libgc_dir) eglib mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
-endif
 
 all: update_submodules
 
index 4999b8f2b48121fe7b9b357f7c5f702edd9c3177..3aadd24e0836b965216fa60bbc422b3493016206 100644 (file)
@@ -3267,14 +3267,17 @@ AC_ARG_WITH(sgen-default-concurrent, [  --with-sgen-default-concurrent=yes,no
 if test x$buildsgen = xyes; then
    AC_DEFINE(HAVE_MOVING_COLLECTOR, 1, [Moving collector])
    SGEN_DEFINES="-DHAVE_SGEN_GC"
-   if test "x$gc_msg" = "x"; then
-      gc_msg="sgen"
-   else
-      gc_msg="sgen and $gc_msg"
-   fi
 
+       conc_gc_msg=""
    if test x$with_sgen_default_concurrent != xno; then
        AC_DEFINE(HAVE_CONC_GC_AS_DEFAULT, 1, [Defaults to concurrent GC])
+          conc_gc_msg=" (concurrent by default)"
+   fi
+
+   if test "x$gc_msg" = "x"; then
+      gc_msg="sgen$conc_gc_msg"
+   else
+      gc_msg="sgen$conc_gc_msg and $gc_msg"
    fi
 fi
 AC_SUBST(SGEN_DEFINES)
@@ -3995,6 +3998,7 @@ tools/Makefile
 tools/locale-builder/Makefile
 tools/sgen/Makefile
 tools/monograph/Makefile
+tools/pedump/Makefile
 runtime/Makefile
 msvc/Makefile
 po/Makefile
index 163b37483c08b5310c4e3d4c2e22a1ed59b1e6e0..9f44f259bf5059df6c8019948ea75313bd09a9fb 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 163b37483c08b5310c4e3d4c2e22a1ed59b1e6e0
+Subproject commit 9f44f259bf5059df6c8019948ea75313bd09a9fb
index 74fc4a03cf2cbd4605da80b3f3059eec57089057..8c414dad79feaced6c3d48e6a4b7ff4865e0e3ff 100644 (file)
@@ -120,7 +120,8 @@ namespace MonoTests.EvaluatorTest
                        Evaluator.Run ("var a = new int[]{1,2,3};");
 
                        object res = Evaluator.Evaluate ("from x in a select x + 1;");
-                       CollectionAssert.AreEqual (new int[] { 2, 3, 4 }, ((IEnumerable<int>) res).ToArray ());
+
+                       Assert.AreEqual (new int[] { 2, 3, 4 }, ((IEnumerable<int>) res).ToArray ());
                }
 
                [Test]
@@ -201,4 +202,4 @@ namespace MonoTests.EvaluatorTest
                }
 
        }
-}
\ No newline at end of file
+}
index a6a92f06430cf0b88a0d535b86db36d8a03f4c60..65b46010fc384b28a5a9b844b25ce1cf24e189e8 100644 (file)
@@ -31,9 +31,9 @@ public class MD2Test {
                if ((array1 == null) && (array2 == null))
                        return;
                if (array1 == null)
-                       Assertion.Fail (msg + " -> First array is NULL");
+                       Assert.Fail (msg + " -> First array is NULL");
                if (array2 == null)
-                       Assertion.Fail (msg + " -> Second array is NULL");
+                       Assert.Fail (msg + " -> Second array is NULL");
         
                bool a = (array1.Length == array2.Length);
                if (a) {
@@ -48,7 +48,7 @@ public class MD2Test {
                        msg += " -> Expected " + BitConverter.ToString (array1, 0);
                        msg += " is different than " + BitConverter.ToString (array2, 0);
                }
-               Assertion.Assert (msg, a);
+               Assert.IsTrue (a, msg);
        }
 
        // MD2 ("") = 8350e5a3e24c153df2275c9f80692773
@@ -208,7 +208,7 @@ public class MD2Test {
                for (int i=0; i < input.Length - 1; i++)
                        hash.TransformBlock (input, i, 1, copy, i);
                byte[] output = hash.TransformFinalBlock (input, input.Length - 1, 1);
-               Assertion.AssertEquals (testName + ".e.1", input [input.Length - 1], output [0]);
+               Assert.AreEqual (input [input.Length - 1], output [0], testName + ".e.1");
                AssertEquals (testName + ".e.2", result, hash.Hash);
                // required or next operation will still return old hash
                hash.Initialize ();
@@ -218,9 +218,9 @@ public class MD2Test {
        public virtual void StaticInfo () 
        {
                string className = hash.ToString ();
-               Assertion.AssertEquals (className + ".HashSize", 128, hash.HashSize);
-               Assertion.AssertEquals (className + ".InputBlockSize", 1, hash.InputBlockSize);
-               Assertion.AssertEquals (className + ".OutputBlockSize", 1, hash.OutputBlockSize);
+               Assert.AreEqual (128, hash.HashSize, className + ".HashSize",);
+               Assert.AreEqual (1, hash.InputBlockSize, className + ".InputBlockSize");
+               Assert.AreEqual (1, hash.OutputBlockSize, className + ".OutputBlockSize");
        }
 }
 
index 308b689b91cce34677cf481c6b557b78c4b823a1..111035eb5acebc0027d66b8a0f145ef094b79f1c 100644 (file)
@@ -31,9 +31,9 @@ public class MD4Test {
                if ((array1 == null) && (array2 == null))
                        return;
                if (array1 == null)
-                       Assertion.Fail (msg + " -> First array is NULL");
+                       Assert.Fail (msg + " -> First array is NULL");
                if (array2 == null)
-                       Assertion.Fail (msg + " -> Second array is NULL");
+                       Assert.Fail (msg + " -> Second array is NULL");
 
                bool a = (array1.Length == array2.Length);
                if (a) {
@@ -48,7 +48,7 @@ public class MD4Test {
                        msg += " -> Expected " + BitConverter.ToString (array1, 0);
                        msg += " is different than " + BitConverter.ToString (array2, 0);
                }
-               Assertion.Assert (msg, a);
+               Assert.IsTrue (a, msg);
        }
 
        // MD4 ("") = 31d6cfe0d16ae931b73c59d7e0c089c0
@@ -208,7 +208,7 @@ public class MD4Test {
                for (int i=0; i < input.Length - 1; i++)
                        hash.TransformBlock (input, i, 1, copy, i);
                byte[] output = hash.TransformFinalBlock (input, input.Length - 1, 1);
-               Assertion.AssertEquals (testName + ".e.1", input [input.Length - 1], output [0]);
+               Assert.AreEqual (input [input.Length - 1], output [0], testName + ".e.1");
                AssertEquals (testName + ".e.2", result, hash.Hash);
                // required or next operation will still return old hash
                hash.Initialize ();
@@ -218,9 +218,9 @@ public class MD4Test {
        public virtual void StaticInfo () 
        {
                string className = hash.ToString ();
-               Assertion.AssertEquals (className + ".HashSize", 128, hash.HashSize);
-               Assertion.AssertEquals (className + ".InputBlockSize", 1, hash.InputBlockSize);
-               Assertion.AssertEquals (className + ".OutputBlockSize", 1, hash.OutputBlockSize);
+               Assert.AreEqual (128, hash.HashSize, className + ".HashSize");
+               Assert.AreEqual (1, hash.InputBlockSize, className + ".InputBlockSize");
+               Assert.AreEqual (1, hash.OutputBlockSize, className + ".OutputBlockSize");
        }
 }
 
index 1eb7078938063058c27009e421bf3d59ca4c88fc..a5796e910d77de3be4ff2c9063186e803cf79a37 100644 (file)
@@ -33,9 +33,9 @@ public class MD5Test {
                if ((array1 == null) && (array2 == null))
                        return;
                if (array1 == null)
-                       Assertion.Fail (msg + " -> First array is NULL");
+                       Assert.Fail (msg + " -> First array is NULL");
                if (array2 == null)
-                       Assertion.Fail (msg + " -> Second array is NULL");
+                       Assert.Fail (msg + " -> Second array is NULL");
 
                bool a = (array1.Length == array2.Length);
                if (a) {
@@ -50,7 +50,7 @@ public class MD5Test {
                        msg += " -> Expected " + BitConverter.ToString (array1, 0);
                        msg += " is different than " + BitConverter.ToString (array2, 0);
                }
-               Assertion.Assert (msg, a);
+               Assert.IsTrue (a, msg);
        }
 
        // MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
@@ -210,7 +210,7 @@ public class MD5Test {
                for (int i=0; i < input.Length - 1; i++)
                        hash.TransformBlock (input, i, 1, copy, i);
                byte[] output = hash.TransformFinalBlock (input, input.Length - 1, 1);
-               Assertion.AssertEquals (testName + ".e.1", input [input.Length - 1], output [0]);
+               Assert.AreEqual (input [input.Length - 1], output [0], testName + ".e.1");
                AssertEquals (testName + ".e.2", result, hash.Hash);
                // required or next operation will still return old hash
                hash.Initialize ();
@@ -220,9 +220,9 @@ public class MD5Test {
        public virtual void StaticInfo () 
        {
                string className = hash.ToString ();
-               Assertion.AssertEquals (className + ".HashSize", 128, hash.HashSize);
-               Assertion.AssertEquals (className + ".InputBlockSize", 1, hash.InputBlockSize);
-               Assertion.AssertEquals (className + ".OutputBlockSize", 1, hash.OutputBlockSize);
+               Assert.AreEqual (128, hash.HashSize, className + ".HashSize");
+               Assert.AreEqual (1, hash.InputBlockSize, className + ".InputBlockSize");
+               Assert.AreEqual (1, hash.OutputBlockSize, className + ".OutputBlockSize");
        }
 }
 
index 0ef2206f50bf676319b97dce97070cc25231072c..358beca8d065370879c08a4621d6a37d432d83cb 100644 (file)
@@ -33,9 +33,9 @@ public class SHA1Test {
                if ((array1 == null) && (array2 == null))
                        return;
                if (array1 == null)
-                       Assertion.Fail (msg + " -> First array is NULL");
+                       Assert.Fail (msg + " -> First array is NULL");
                if (array2 == null)
-                       Assertion.Fail (msg + " -> Second array is NULL");
+                       Assert.Fail (msg + " -> Second array is NULL");
 
                bool a = (array1.Length == array2.Length);
                if (a) {
@@ -48,7 +48,7 @@ public class SHA1Test {
                }
                msg += " -> Expected " + BitConverter.ToString (array1, 0);
                msg += " is different than " + BitConverter.ToString (array2, 0);
-               Assertion.Assert (msg, a);
+               Assert.IsTrue (a, msg);
        }
 
        [SetUp]
@@ -63,12 +63,12 @@ public class SHA1Test {
        {
                // test all values static for SHA1
                string className = hash.ToString ();
-               Assertion.AssertEquals (className + ".HashSize", 160, hash.HashSize);
-               Assertion.AssertEquals (className + ".InputBlockSize", 1, hash.InputBlockSize);
-               Assertion.AssertEquals (className + ".OutputBlockSize", 1, hash.OutputBlockSize);
-               Assertion.AssertEquals (className + ".CanReuseTransform", true, hash.CanReuseTransform);
-               Assertion.AssertEquals (className + ".CanTransformMultipleBlocks", true, hash.CanTransformMultipleBlocks);
-               Assertion.AssertEquals (className + ".ToString()", "Mono.Security.Cryptography.SHA1CryptoServiceProvider", className);
+               Assert.AreEqual (className + ".HashSize", 160, hash.HashSize);
+               Assert.AreEqual (className + ".InputBlockSize", 1, hash.InputBlockSize);
+               Assert.AreEqual (className + ".OutputBlockSize", 1, hash.OutputBlockSize);
+               Assert.AreEqual (className + ".CanReuseTransform", true, hash.CanReuseTransform);
+               Assert.AreEqual (className + ".CanTransformMultipleBlocks", true, hash.CanTransformMultipleBlocks);
+               Assert.AreEqual (className + ".ToString()", "Mono.Security.Cryptography.SHA1CryptoServiceProvider", className);
        }
 
        // First test, we hash the string "abc"
index 989adb7697a272b8baefa1a2b6dbd417aa6234a6..56cec328adbcb1f52a4e31f7124d1d8e83721188 100644 (file)
@@ -22,7 +22,7 @@ namespace MonoTests.Mono.Math {
 
                protected void Expect (BigInteger actual, BigInteger expected) 
                {
-                       Assertion.AssertEquals (Name, expected, actual);
+                       Assert.AreEqual (expected, actual, Name);
                }
        }
 }
index 4cf969f69d05d48bf6ba8c61e293f7811ffe5f23..2abf162a89c6869d89d07d93f78c51ee1135ca20 100644 (file)
@@ -81,12 +81,12 @@ namespace MonoTests.Mono.Math {
 
                private void ExpectComposite (BigInteger bi)
                {
-                       Assertion.AssertEquals (false, bi.IsProbablePrime ());
+                       Assert.AreEqual (false, bi.IsProbablePrime ());
                }
 
                private void ExpectPrime (BigInteger bi)
                {
-                       Assertion.AssertEquals (true, bi.IsProbablePrime ());
+                       Assert.AreEqual (true, bi.IsProbablePrime ());
                }
        }
 
@@ -195,7 +195,7 @@ namespace MonoTests.Mono.Math {
        // Adapted from http://lists.ximian.com/archives/public/mono-devel-list/2003-November/003026.html
        // Note: these primes are taken from RFC 2412 [http://www.faqs.org/rfcs/rfc2412.html]
        [TestFixture]
-       public class Rfc2412WellTestedPrimes : Assertion {
+       public class Rfc2412WellTestedPrimes {
 
                // E.1. Well-Known Group 1:  A 768 bit prime
                [Test]
@@ -203,8 +203,8 @@ namespace MonoTests.Mono.Math {
                {
                        string prime = "1552518092300708935130918131258481755631334049434514313202351194902966239949102107258669453876591642442910007680288864229150803718918046342632727613031282983744380820890196288509170691316593175367469551763119843371637221007210577919";
                        BigInteger bi = BigInteger.Parse (prime);
-                       Assert ("isProbablePrime-768", bi.IsProbablePrime ());
-                       AssertEquals ("ToString()", prime, bi.ToString ());
+                       Assert.IsTrue (bi.IsProbablePrime (), "isProbablePrime-768");
+                       Assert.AreEqual (prime, bi.ToString (), "ToString()");
                }
 
                // E.2. Well-Known Group 2:  A 1024 bit prime
@@ -213,8 +213,8 @@ namespace MonoTests.Mono.Math {
                {
                        string prime = "179769313486231590770839156793787453197860296048756011706444423684197180216158519368947833795864925541502180565485980503646440548199239100050792877003355816639229553136239076508735759914822574862575007425302077447712589550957937778424442426617334727629299387668709205606050270810842907692932019128194467627007";
                        BigInteger bi = BigInteger.Parse (prime);
-                       Assert ("isProbablePrime-1024", bi.IsProbablePrime ());
-                       AssertEquals ("ToString()", prime, bi.ToString ());
+                       Assert.IsTrue (bi.IsProbablePrime (), "isProbablePrime-1024");
+                       Assert.AreEqual (prime, bi.ToString (), "ToString()");
                }
 
                // Note: E.3 and E.4 are for Elliptic Curve Groups
@@ -225,8 +225,8 @@ namespace MonoTests.Mono.Math {
                {
                        string prime = "2410312426921032588552076022197566074856950548502459942654116941958108831682612228890093858261341614673227141477904012196503648957050582631942730706805009223062734745341073406696246014589361659774041027169249453200378729434170325843778659198143763193776859869524088940195577346119843545301547043747207749969763750084308926339295559968882457872412993810129130294592999947926365264059284647209730384947211681434464714438488520940127459844288859336526896320919633919";
                        BigInteger bi = BigInteger.Parse (prime);
-                       Assert ("isProbablePrime-1536", bi.IsProbablePrime ());
-                       AssertEquals ("ToString()", prime, bi.ToString ());
+                       Assert.IsTrue (bi.IsProbablePrime (), "isProbablePrime-1536");
+                       Assert.AreEqual (prime, bi.ToString (), "ToString()");
                }
        }
 
index 80434f9983ca1dd3296fe96cfdfbdf61372dc34f..e77246dc9568dfe60c81d27d1009955bd487db17 100644 (file)
@@ -34,7 +34,7 @@ namespace MonoTests.Mono.Math {
                        ContextData ctx = (ContextData)Context;
 
                        
-                       Assertion.AssertEquals (ctx.bits, bits);
+                       Assert.AreEqual (ctx.bits, bits);
                        uint d = ctx.testData;
 
                        for (uint i = (uint)bits - 2; d > 0; i--, d >>= 1)
@@ -65,7 +65,7 @@ namespace MonoTests.Mono.Math {
                                Assert.IsTrue (p.TestBit (1));
                                uint d = ctx.testData;
                                for (uint j = 128 - 2; d > 0; j--, d >>= 1)
-                                       Assertion.AssertEquals ((d&1) == 1, p.TestBit (j));
+                                       Assert.AreEqual ((d&1) == 1, p.TestBit (j));
                        }
                }
        }
index 0f529496e1183d56568e8535ed5a0f53a4aa9629..8696657715e03258c3c79fa620c2e0498af263b0 100644 (file)
@@ -68,7 +68,7 @@ namespace MonoTests.Mono.Security.Authenticode {
 // makecert -n "CN=PVK1" -sv 1.pvk 1.cer
 
 [TestFixture]
-public class PrivateKeyTest : Assertion {
+public class PrivateKeyTest {
 
        // because most crypto stuff works with byte[] buffers
        static public void AssertEquals (string msg, byte[] array1, byte[] array2) 
@@ -76,9 +76,9 @@ public class PrivateKeyTest : Assertion {
                if ((array1 == null) && (array2 == null))
                        return;
                if (array1 == null)
-                       Fail (msg + " -> First array is NULL");
+                       Assert.Fail (msg + " -> First array is NULL");
                if (array2 == null)
-                       Fail (msg + " -> Second array is NULL");
+                       Assert.Fail (msg + " -> Second array is NULL");
 
                bool a = (array1.Length == array2.Length);
                if (a) {
@@ -93,7 +93,7 @@ public class PrivateKeyTest : Assertion {
                        msg += " -> Expected " + BitConverter.ToString (array1, 0);
                        msg += " is different than " + BitConverter.ToString (array2, 0);
                }
-               Assert (msg, a);
+               Assert.IsTrue (a, msg);
        }
 
        string testfile;
@@ -152,10 +152,10 @@ public class PrivateKeyTest : Assertion {
        {
                WriteBuffer (nopwd);
                PrivateKey pvk = PrivateKey.CreateFromFile (testfile);
-               AssertNotNull ("msnopwd.RSA", pvk.RSA);
-               Assert ("msnopwd.Encrypted", !pvk.Encrypted);
-               Assert ("msnopwd.Weak", pvk.Weak);
-               AssertEquals ("msnopwd.KeyType", 2, pvk.KeyType);
+               Assert.IsNotNull (pvk.RSA, "msnopwd.RSA");
+               Assert.IsTrue (!pvk.Encrypted, "msnopwd.Encrypted");
+               Assert.IsTrue (pvk.Weak, "msnopwd.Weak");
+               Assert.AreEqual (2, pvk.KeyType, "msnopwd.KeyType");
        }
 
        // this will convert a PVK file without a password to a PVK file
@@ -168,11 +168,11 @@ public class PrivateKeyTest : Assertion {
                string rsa1 = pvk.RSA.ToXmlString (true);
                pvk.Save (testfile, "password");
                pvk = PrivateKey.CreateFromFile (testfile, "password");
-               AssertNotNull ("topwd.RSA", pvk.RSA);
+               Assert.IsNotNull (pvk.RSA, "topwd.RSA");
                string rsa2 = pvk.RSA.ToXmlString (true);
-               AssertEquals ("topwd.RSA identical", rsa1, rsa2);
-               Assert ("topwd.Encrypted", pvk.Encrypted);
-               Assert ("topwd.Weak", pvk.Weak);
+               Assert.AreEqual (rsa1, rsa2, "topwd.RSA identical");
+               Assert.IsTrue (pvk.Encrypted, "topwd.Encrypted");
+               Assert.IsTrue (pvk.Weak, "topwd.Weak");
        }
 
        // this will convert a PVK file without a password to a PVK file
@@ -186,11 +186,11 @@ public class PrivateKeyTest : Assertion {
                pvk.Weak = false; // we want strong crypto
                pvk.Save (testfile, "password");
                pvk = PrivateKey.CreateFromFile (testfile, "password");
-               AssertNotNull ("topwd.RSA", pvk.RSA);
+               Assert.IsNotNull (pvk.RSA, "topwd.RSA");
                string rsa2 = pvk.RSA.ToXmlString (true);
-               AssertEquals ("topwd.RSA identical", rsa1, rsa2);
-               Assert ("topwd.Encrypted", pvk.Encrypted);
-               Assert ("topwd.Weak", !pvk.Weak);
+               Assert.AreEqual (rsa1, rsa2, "topwd.RSA identical");
+               Assert.IsTrue (pvk.Encrypted, "topwd.Encrypted");
+               Assert.IsTrue (!pvk.Weak, "topwd.Weak");
        }
 
        static byte[] pwd = { 
@@ -229,9 +229,9 @@ public class PrivateKeyTest : Assertion {
        {
                WriteBuffer (pwd);
                PrivateKey pvk = PrivateKey.CreateFromFile (testfile, "password");
-               AssertNotNull ("mspwd.RSA", pvk.RSA);
-               Assert ("mspwd.Encrypted", pvk.Encrypted);
-               Assert ("mspwd.Weak", pvk.Weak);
+               Assert.IsNotNull (pvk.RSA, "mspwd.RSA");
+               Assert.IsTrue (pvk.Encrypted, "mspwd.Encrypted");
+               Assert.IsTrue (pvk.Weak, "mspwd.Weak");
        }
 
        // this will convert a PVK file with a password to a PVK file
@@ -244,11 +244,11 @@ public class PrivateKeyTest : Assertion {
                string rsa1 = pvk.RSA.ToXmlString (true);
                pvk.Save (testfile);
                pvk = PrivateKey.CreateFromFile (testfile);
-               AssertNotNull ("nomorepwd.RSA", pvk.RSA);
+               Assert.IsNotNull (pvk.RSA, "nomorepwd.RSA");
                string rsa2 = pvk.RSA.ToXmlString (true);
-               AssertEquals ("nomorepwd.RSA identical", rsa1, rsa2);
-               Assert ("nomorepwd.Encrypted", !pvk.Encrypted);
-               Assert ("nomorepwd.Weak", pvk.Weak);
+               Assert.AreEqual (rsa1, rsa2, "nomorepwd.RSA identical");
+               Assert.IsTrue (!pvk.Encrypted, "nomorepwd.Encrypted");
+               Assert.IsTrue (pvk.Weak, "nomorepwd.Weak");
        }
        
        [Test]
@@ -261,11 +261,11 @@ public class PrivateKeyTest : Assertion {
                pvk.Save (testfile, "mono");
 
                pvk = PrivateKey.CreateFromFile (testfile, "mono");
-               AssertNotNull ("new.RSA", pvk.RSA);
+               Assert.IsNotNull (pvk.RSA, "new.RSA");
                string rsa2 = pvk.RSA.ToXmlString (true);
-               AssertEquals ("new.RSA identical", rsa1, rsa2);
-               Assert ("new.Encrypted", pvk.Encrypted);
-               Assert ("new.Weak", !pvk.Weak);
+               Assert.AreEqual (rsa1, rsa2, "new.RSA identical");
+               Assert.IsTrue (pvk.Encrypted, "new.Encrypted");
+               Assert.IsTrue (!pvk.Weak, "new.Weak");
        }
 
        [Test]
index 38ecbc3b2358952724e7b843200a136b3b013d91..a527208839abf2a3d9e02bda5c63e177d6fac637 100644 (file)
@@ -15,7 +15,7 @@ using Mono.Security.Cryptography;
 namespace MonoTests.Mono.Security.Cryptography {
 
        [TestFixture]
-       public class CryptoConvertTest : Assertion {
+       public class CryptoConvertTest {
 
                // because most crypto stuff works with byte[] buffers
                static public void AssertEquals (string msg, byte[] array1, byte[] array2) 
@@ -23,9 +23,9 @@ namespace MonoTests.Mono.Security.Cryptography {
                        if ((array1 == null) && (array2 == null))
                                return;
                        if (array1 == null)
-                               Fail (msg + " -> First array is NULL");
+                               Assert.Fail (msg + " -> First array is NULL");
                        if (array2 == null)
-                               Fail (msg + " -> Second array is NULL");
+                               Assert.Fail (msg + " -> Second array is NULL");
                
                        bool a = (array1.Length == array2.Length);
                        if (a) {
@@ -38,7 +38,7 @@ namespace MonoTests.Mono.Security.Cryptography {
                        }
                        msg += " -> Expected " + BitConverter.ToString (array1, 0);
                        msg += " is different than " + BitConverter.ToString (array2, 0);
-                       Assert (msg, a);
+                       Assert.IsTrue (a, msg);
                }
 
                // strongname generated using "sn -k unit.snk"
@@ -163,16 +163,16 @@ namespace MonoTests.Mono.Security.Cryptography {
                {
                        // keypair
                        RSA rsa = CryptoConvert.FromCapiKeyBlob (strongName, 0);
-                       AssertEquals ("KeyPair", strongNameString, rsa.ToXmlString (true));
-                       AssertEquals ("PublicKey-1", strongNamePublicKeyString, rsa.ToXmlString (false));
+                       Assert.AreEqual (strongNameString, rsa.ToXmlString (true), "KeyPair");
+                       Assert.AreEqual (strongNamePublicKeyString, rsa.ToXmlString (false), "PublicKey-1");
 
                        // public key (direct)
                        rsa = CryptoConvert.FromCapiKeyBlob (strongNamePublicKey, 12);
-                       AssertEquals ("PublicKey-2", strongNamePublicKeyString, rsa.ToXmlString (false));
+                       Assert.AreEqual (strongNamePublicKeyString, rsa.ToXmlString (false), "PublicKey-2");
 
                        // public key (indirect - inside header)
                        rsa = CryptoConvert.FromCapiKeyBlob (strongNamePublicKey, 0);
-                       AssertEquals ("PublicKey-3", strongNamePublicKeyString, rsa.ToXmlString (false));
+                       Assert.AreEqual (strongNamePublicKeyString, rsa.ToXmlString (false), "PublicKey-3");
                }
 
                [Test]
@@ -201,7 +201,7 @@ namespace MonoTests.Mono.Security.Cryptography {
                public void FromCapiPrivateKeyBlob () 
                {
                        RSA rsa = CryptoConvert.FromCapiPrivateKeyBlob (strongName, 0);
-                       AssertEquals ("KeyPair", strongNameString, rsa.ToXmlString (true));
+                       Assert.AreEqual (strongNameString, rsa.ToXmlString (true), "KeyPair");
                }
 
                [Test]
@@ -229,7 +229,7 @@ namespace MonoTests.Mono.Security.Cryptography {
                public void FromCapiPublicKeyBlob () 
                {
                        RSA rsa = CryptoConvert.FromCapiPublicKeyBlob (strongNamePublicKey, 12);
-                       AssertEquals ("PublicKey", strongNamePublicKeyString, rsa.ToXmlString (false));
+                       Assert.AreEqual (strongNamePublicKeyString, rsa.ToXmlString (false), "PublicKey");
                }
 
                [Test]
@@ -262,12 +262,12 @@ namespace MonoTests.Mono.Security.Cryptography {
                        AssertEquals ("RSA-KeyPair", strongName, keypair);
 
                        byte[] publicKey = CryptoConvert.ToCapiKeyBlob (rsa, false);
-                       AssertEquals ("RSA-PublicKey", BitConverter.ToString (strongNamePublicKey, 12), BitConverter.ToString (publicKey));
+                       Assert.AreEqual (BitConverter.ToString (strongNamePublicKey, 12), BitConverter.ToString (publicKey), "RSA-PublicKey");
                        
                        AsymmetricAlgorithm dsa = DSA.Create ();
                        dsa.FromXmlString (dsaKeyPairString);
                        AssertEquals ("DSA-KeyPair", dsaPrivBlob, CryptoConvert.ToCapiKeyBlob (dsa, true));
-                       AssertEquals ("DSA-PublicKey", BitConverter.ToString (dsaPubBlob), BitConverter.ToString (CryptoConvert.ToCapiKeyBlob (dsa, false)));
+                       Assert.AreEqual (BitConverter.ToString (dsaPubBlob), BitConverter.ToString (CryptoConvert.ToCapiKeyBlob (dsa, false)), "DSA-PublicKey");
                }
 
                [Test]
@@ -279,7 +279,7 @@ namespace MonoTests.Mono.Security.Cryptography {
                        AssertEquals ("KeyPair", strongName, keypair);
 
                        byte[] publicKey = CryptoConvert.ToCapiKeyBlob (rsa, false);
-                       AssertEquals ("PublicKey", BitConverter.ToString (strongNamePublicKey, 12), BitConverter.ToString (publicKey));
+                       Assert.AreEqual (BitConverter.ToString (strongNamePublicKey, 12), BitConverter.ToString (publicKey), "PublicKey");
                }
 
                [Test]
@@ -323,11 +323,11 @@ namespace MonoTests.Mono.Security.Cryptography {
                        // full keypair
                        rsa.FromXmlString (strongNameString);
                        byte[] publicKey = CryptoConvert.ToCapiPublicKeyBlob (rsa);
-                       AssertEquals ("PublicKey-1", BitConverter.ToString (strongNamePublicKey, 12), BitConverter.ToString (publicKey));
+                       Assert.AreEqual (BitConverter.ToString (strongNamePublicKey, 12), BitConverter.ToString (publicKey), "PublicKey-1");
                        // public key only
                        rsa.FromXmlString (strongNamePublicKeyString);
                        publicKey = CryptoConvert.ToCapiPublicKeyBlob (rsa);
-                       AssertEquals ("PublicKey-2", BitConverter.ToString (strongNamePublicKey, 12), BitConverter.ToString (publicKey));
+                       Assert.AreEqual (BitConverter.ToString (strongNamePublicKey, 12), BitConverter.ToString (publicKey), "PublicKey-2");
                }
 
                /* DSA key tests */
@@ -419,8 +419,8 @@ namespace MonoTests.Mono.Security.Cryptography {
                public void FromCapiKeyBlobDSA ()
                {
                        DSA dsa = CryptoConvert.FromCapiKeyBlobDSA (dsaPrivBlob);
-                       AssertEquals ("KeyPair", dsaKeyPairString, dsa.ToXmlString (true));
-                       AssertEquals ("PublicKey", dsaPubKeyString, dsa.ToXmlString (false));
+                       Assert.AreEqual (dsaKeyPairString, dsa.ToXmlString (true), "KeyPair");
+                       Assert.AreEqual (dsaPubKeyString, dsa.ToXmlString (false), "PublicKey");
                }
 
                [Test]
@@ -449,7 +449,7 @@ namespace MonoTests.Mono.Security.Cryptography {
                public void FromCapiPrivateKeyBlobDSA ()
                {
                        DSA dsa = CryptoConvert.FromCapiPrivateKeyBlobDSA (dsaPrivBlob, 0);
-                       AssertEquals ("KeyPair", dsaKeyPairString, dsa.ToXmlString (true));
+                       Assert.AreEqual (dsaKeyPairString, dsa.ToXmlString (true), "KeyPair");
                }
 
                [Test]
@@ -478,7 +478,7 @@ namespace MonoTests.Mono.Security.Cryptography {
                public void FromCapiPublicKeyBlobDSA ()
                {
                        DSA dsa = CryptoConvert.FromCapiPublicKeyBlobDSA (dsaPubBlob, 0);
-                       AssertEquals ("PublicKey", dsaPubKeyString, dsa.ToXmlString (false));
+                       Assert.AreEqual (dsaPubKeyString, dsa.ToXmlString (false), "PublicKey");
                }
 
                [Test]
@@ -512,7 +512,7 @@ namespace MonoTests.Mono.Security.Cryptography {
                        AssertEquals ("KeyPair", dsaPrivBlob, keypair);
 
                        byte[] pubkey = CryptoConvert.ToCapiKeyBlob (dsa, false);
-                       AssertEquals ("PublicKey", BitConverter.ToString (dsaPubBlob), BitConverter.ToString (pubkey));
+                       Assert.AreEqual (BitConverter.ToString (dsaPubBlob), BitConverter.ToString (pubkey), "PublicKey");
                }
 
                [Test]
@@ -548,20 +548,20 @@ namespace MonoTests.Mono.Security.Cryptography {
                        // full keypair
                        dsa.FromXmlString (dsaKeyPairString);
                        byte[] pubkey = CryptoConvert.ToCapiPublicKeyBlob (dsa);
-                       AssertEquals ("PublicKey-1", BitConverter.ToString (dsaPubBlob), BitConverter.ToString (pubkey));
+                       Assert.AreEqual (BitConverter.ToString (dsaPubBlob), BitConverter.ToString (pubkey), "PublicKey-1");
 
                        // public key only
                        dsa.FromXmlString (dsaPubKeyString);
                        pubkey = CryptoConvert.ToCapiPublicKeyBlob (dsa);
-                       AssertEquals ("PublicKey-2", BitConverter.ToString (dsaPubBlob), BitConverter.ToString (pubkey));
+                       Assert.AreEqual (BitConverter.ToString (dsaPubBlob), BitConverter.ToString (pubkey), "PublicKey-2");
                }
 
                [Test]
                public void FromHex () 
                {
-                       AssertNull ("FromHex(null)", CryptoConvert.FromHex (null));
+                       Assert.IsNull (CryptoConvert.FromHex (null), "FromHex(null)");
                        string result = BitConverter.ToString (CryptoConvert.FromHex ("0123456789aBcDeF"));
-                       AssertEquals ("0123456789abcdef", "01-23-45-67-89-AB-CD-EF", result);
+                       Assert.AreEqual ("01-23-45-67-89-AB-CD-EF", result, "0123456789abcdef");
                }
 
                [Test]
@@ -581,9 +581,9 @@ namespace MonoTests.Mono.Security.Cryptography {
                [Test]
                public void ToHex () 
                {
-                       AssertNull ("FromHex(null)", CryptoConvert.FromHex (null));
+                       Assert.IsNull (CryptoConvert.FromHex (null), "FromHex(null)");
                        byte[] data = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
-                       AssertEquals ("0123456789abcdef", "0123456789ABCDEF", CryptoConvert.ToHex (data));
+                       Assert.AreEqual ("0123456789ABCDEF", CryptoConvert.ToHex (data), "0123456789abcdef");
                }
                
                [Test]
@@ -595,8 +595,8 @@ namespace MonoTests.Mono.Security.Cryptography {
                        RSA rsa = CryptoConvert.FromCapiKeyBlob (strongNameNUnit, 0);
                        // note the bad D parameters !!!
                        // this only works because CRT is being used
-                       AssertEquals ("KeyPair", "<RSAKeyValue><Modulus>rB8h0TaMs8fWA+5WMdcjOjejCZwhYwuFHUZPS0cC9TOG6FJtvlHPpZLQAg0xfLr2SivPRol1Xw9SqhuaYQNJA7sAaOb8Rvgmx93XbmcNotY9ob4TGaesk+M8VsdexsIJ3WlyLbmRlf0EjT52nboyauEL3UC85zkMjW1LNb8LSs8=</Modulus><Exponent>AQAB</Exponent><P>2d4pGForvc792ztFxhNuzxIihDnXp+qK9F8t/NduhRBdu+JXK4d8a9EGwzpMxLUPlHjCZfXRraZiSQszkH+nzQ==</P><Q>yj9BeGmOrucOUCNZYTtXI0ykzz+1g+cVMSxi+6xzoLEOqmdE4gjcWaxak4MF1+pIR6UycnNa/jg1LBl7MKxpCw==</Q><DP>cMkAjznG4Sjx4/dIRKU0vP/PXJIxIR1bN+y5+uVvsnTpgWVH6SHneE0qahCZQ0/UM/Fb+bqLBJFY2iVxWUGslQ==</DP><DQ>gz6TXPGbLzMv3Z9i5C8e+ABHv1pHj6ZI4VU9kraxfmkH7FsBn3FClUq8qJdRFnGpoBy65Pyo4upUzx5mDAsGSw==</DQ><InverseQ>x+UShV+0d9cicoiB9fkSLqpLDyF4dYzVu0uqX0eCcoGJpk19jtSaMI3Eo8VN6MJAW1zrRy+MA1Fqb9qeThLqZQ==</InverseQ><D>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</D></RSAKeyValue>", rsa.ToXmlString (true));
-                       AssertEquals ("PublicKey", "<RSAKeyValue><Modulus>rB8h0TaMs8fWA+5WMdcjOjejCZwhYwuFHUZPS0cC9TOG6FJtvlHPpZLQAg0xfLr2SivPRol1Xw9SqhuaYQNJA7sAaOb8Rvgmx93XbmcNotY9ob4TGaesk+M8VsdexsIJ3WlyLbmRlf0EjT52nboyauEL3UC85zkMjW1LNb8LSs8=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>", rsa.ToXmlString (false));
+                       Assert.AreEqual ("<RSAKeyValue><Modulus>rB8h0TaMs8fWA+5WMdcjOjejCZwhYwuFHUZPS0cC9TOG6FJtvlHPpZLQAg0xfLr2SivPRol1Xw9SqhuaYQNJA7sAaOb8Rvgmx93XbmcNotY9ob4TGaesk+M8VsdexsIJ3WlyLbmRlf0EjT52nboyauEL3UC85zkMjW1LNb8LSs8=</Modulus><Exponent>AQAB</Exponent><P>2d4pGForvc792ztFxhNuzxIihDnXp+qK9F8t/NduhRBdu+JXK4d8a9EGwzpMxLUPlHjCZfXRraZiSQszkH+nzQ==</P><Q>yj9BeGmOrucOUCNZYTtXI0ykzz+1g+cVMSxi+6xzoLEOqmdE4gjcWaxak4MF1+pIR6UycnNa/jg1LBl7MKxpCw==</Q><DP>cMkAjznG4Sjx4/dIRKU0vP/PXJIxIR1bN+y5+uVvsnTpgWVH6SHneE0qahCZQ0/UM/Fb+bqLBJFY2iVxWUGslQ==</DP><DQ>gz6TXPGbLzMv3Z9i5C8e+ABHv1pHj6ZI4VU9kraxfmkH7FsBn3FClUq8qJdRFnGpoBy65Pyo4upUzx5mDAsGSw==</DQ><InverseQ>x+UShV+0d9cicoiB9fkSLqpLDyF4dYzVu0uqX0eCcoGJpk19jtSaMI3Eo8VN6MJAW1zrRy+MA1Fqb9qeThLqZQ==</InverseQ><D>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</D></RSAKeyValue>", rsa.ToXmlString (true), "KeyPair");
+                       Assert.AreEqual ("<RSAKeyValue><Modulus>rB8h0TaMs8fWA+5WMdcjOjejCZwhYwuFHUZPS0cC9TOG6FJtvlHPpZLQAg0xfLr2SivPRol1Xw9SqhuaYQNJA7sAaOb8Rvgmx93XbmcNotY9ob4TGaesk+M8VsdexsIJ3WlyLbmRlf0EjT52nboyauEL3UC85zkMjW1LNb8LSs8=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>", rsa.ToXmlString (false), "PublicKey");
                }
        }
 }
index 2a38eb819dc21dca2764a0f76d80c7ff007a84a0..a0d3caf1f7d2aa4f6b1c4f866b36fe06a6200ca0 100644 (file)
@@ -24,7 +24,7 @@ namespace MonoTests.Mono.Security.Cryptography {
        //      http://www.ietf.org/rfc/rfc2631.txt
 
        [TestFixture]
-       public class DiffieHellmanManagedTest : Assertion {
+       public class DiffieHellmanManagedTest {
 
                // because most crypto stuff works with byte[] buffers
                static public void AssertEquals (string msg, byte[] array1, byte[] array2) 
@@ -32,9 +32,9 @@ namespace MonoTests.Mono.Security.Cryptography {
                        if ((array1 == null) && (array2 == null))
                                return;
                        if (array1 == null)
-                               Assertion.Fail (msg + " -> First array is NULL");
+                               Assert.Fail (msg + " -> First array is NULL");
                        if (array2 == null)
-                               Assertion.Fail (msg + " -> Second array is NULL");
+                               Assert.Fail (msg + " -> Second array is NULL");
 
                        bool a = (array1.Length == array2.Length);
                        if (a) {
@@ -49,7 +49,7 @@ namespace MonoTests.Mono.Security.Cryptography {
                                msg += " -> Expected " + BitConverter.ToString (array1, 0);
                                msg += " is different than " + BitConverter.ToString (array2, 0);
                        }
-                       Assertion.Assert (msg, a);
+                       Assert.IsTrue (a, msg);
                }
 
                [Test]
@@ -70,7 +70,7 @@ namespace MonoTests.Mono.Security.Cryptography {
                        // let the second DH instance compute the shared secret using the first DH public key
                        byte[] dh2k = dh2.DecryptKeyExchange (ke1);
                        // both shared secrets are the same
-                       AssertEquals ("Shared Secret", dh1k, dh2k);
+                       Assert.AreEqual (dh1k, dh2k, "Shared Secret");
                }
 
                // TODO: More is needed !
index 42f7584e1c9683712c3a668fd4aabad1dfc6041c..8ec9779b2db08e6ed676fa9033f4b8775b2a9cbe 100644 (file)
@@ -19,7 +19,7 @@ using NUnit.Framework;
 namespace MonoTests.Mono.Security.Cryptography {
 
        [TestFixture]
-       public class PKCS8Test : Assertion {
+       public class PKCS8Test {
 
                static public byte[] pkcs8_der = { 0x30, 0x82, 0x02, 0xB2, 0x30, 0x1C, 0x06, 0x0A, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x0C, 0x01, 0x03, 0x30, 0x0E, 0x04, 0x08, 0x86, 0x2A, 0xA9, 0x71, 0x6D, 0xA4, 0xB8, 0x2D, 0x02, 0x02, 0x07, 0xD0, 0x04, 0x82, 0x02, 0x90, 0x90, 0x14, 0xB5, 0xF0, 0xB6, 0x86, 0x56, 0xCB, 0xFA, 0x63, 0xAD, 0x9F, 0x5A, 0x59, 0x6C, 0xAD, 0x00, 0x3C, 0x37, 0x8A, 0xC3, 0x88, 0x58, 0x8B, 0xD7, 0x48, 0x53, 0x7A, 0xC8, 0x5B, 0x0D, 0x98, 0xDD, 0x8B, 0xB3, 0xEC, 0x4C, 0xAC, 0x61, 0x18, 0xE3, 0x5E, 0x47, 0xAD, 0xC7, 0x92, 0xBC, 0xD3, 0x00, 0x07, 0xFF, 0x1A, 0x68, 0x74, 0x45, 0x8E, 0xD8, 0x7C, 0x9F, 0x18, 0x7B, 0xD7, 0xC8, 
                        0x47, 0xBA, 0x6B, 0x19, 0xF2, 0xBF, 0x7E, 0x51, 0x0B, 0x4B, 0x43, 0xE8, 0xB9, 0x56, 0x7E, 0xD0, 0x74, 0xC7, 0xDE, 0x76, 0xDB, 0xFF, 0x5C, 0x6B, 0x53, 0xBE, 0x31, 0x06, 0xAE, 0x6C, 0x8F, 0xDC, 0x49, 0x04, 0x71, 0x74, 0xEE, 0xB8, 0x06, 0xCB, 0xAD, 0x86, 0xB4, 0x4E, 0xB9, 0x46, 0xA1, 0x03, 0x5E, 0x0E, 0xA7, 0xC7, 0x37, 0x6B, 0xB0, 0x8D, 0x2D, 0x81, 0x1F, 0xE3, 0xC2, 0x05, 0xDE, 0xEF, 0x51, 0x07, 0x70, 0x6E, 0x35, 0x9A, 0xAD, 0x19, 0x5E, 0xAF, 0xEB, 0x7F, 0xEF, 0xE4, 0xAB, 0x07, 0xF3, 0xF6, 0xEA, 0xFA, 0x0E, 0x83, 0x65, 0x06, 0x3C, 0xF3, 0xBD, 0x96, 0x08, 0x14, 0xC5, 0x34, 0x26, 0xED, 0xC0, 0x10, 
@@ -32,13 +32,13 @@ namespace MonoTests.Mono.Security.Cryptography {
                [Test]
                public void EncryptedPrivateKey_Farscape () 
                {
-                       AssertEquals ("PKCS8.GetType", PKCS8.KeyInfo.EncryptedPrivateKey, PKCS8.GetType (pkcs8_der));
+                       Assert.AreEqual (PKCS8.KeyInfo.EncryptedPrivateKey, PKCS8.GetType (pkcs8_der), "PKCS8.GetType");
                        PKCS8.EncryptedPrivateKeyInfo p8 = new PKCS8.EncryptedPrivateKeyInfo (pkcs8_der);
-                       AssertEquals ("Algorithm", "1.2.840.113549.1.12.1.3", p8.Algorithm);
-                       AssertEquals ("EncryptedData", "90-14-B5-F0-B6-86-56-CB-FA-63-AD-9F-5A-59-6C-AD-00-3C-37-8A-C3-88-58-8B-D7-48-53-7A-C8-5B-0D-98-DD-8B-B3-EC-4C-AC-61-18-E3-5E-47-AD-C7-92-BC-D3-00-07-FF-1A-68-74-45-8E-D8-7C-9F-18-7B-D7-C8-47-BA-6B-19-F2-BF-7E-51-0B-4B-43-E8-B9-56-7E-D0-74-C7-DE-76-DB-FF-5C-6B-53-BE-31-06-AE-6C-8F-DC-49-04-71-74-EE-B8-06-CB-AD-86-B4-4E-B9-46-A1-03-5E-0E-A7-C7-37-6B-B0-8D-2D-81-1F-E3-C2-05-DE-EF-51-07-70-6E-35-9A-AD-19-5E-AF-EB-7F-EF-E4-AB-07-F3-F6-EA-FA-0E-83-65-06-3C-F3-BD-96-08-14-C5-34-26-ED-C0-10-CC-AE-2D-8F-BE-ED-98-0D-88-1B-1E-C7-37-F0-FC-DB-3C-E3-1B-66-52-45-6E-05-A6-D9-12-23-05-5F-E3-9F-7D-21-9B-2E-3E-9E-3C-EE-D1-9B-55-DE-57-60-A5-24-2D-C7-94-EC-FC-B1-6A-65-BD-85-02-5C-58-AA-5A-6A-F3-AC-6B-DD-0E-63-B2-4B-5B-67-3D-C3-BF-E4-C8-EF-3F-89-5A-CD-6D-EF-05-22-2B-72-FF-80-7A-DD-F1-59-A7-6F-00-B1-BD-4D-88-D6-E4-8A-DD-A9-FC-D9-01-0A-65-8E-52-F9-7E-20-72-67-0D-5B-EE-67-5B-46-4A-15-A2-6F-15-2B-5B-9A-93-12-4F-F4-AD-49-D0-11-F1-7E-40-DE-32-96-2E-B3-E8-71-60-27-6E-A2-71-83-C7-FE-0E-8B-31-06-64-E1-19-02-B9-44-25-0C-94-64-7E-5F-89-4D-7E-99-0B-91-B8-22-A5-33-92-D3-49-07-1D-C6-25-4A-D7-6D-E2-94-3F-FA-10-72-59-62-F5-C6-D4-3A-EE-8F-BC-9C-BC-FC-C7-37-BF-7C-A0-67-B0-FF-0F-29-A0-A2-71-6B-21-00-F4-54-D9-3D-1B-CE-F4-FE-6F-F5-21-CB-47-58-17-F6-45-2F-A0-3B-8B-D9-B8-8A-33-3F-16-E0-C7-8A-B8-11-2F-A8-7E-7D-A7-7B-65-27-89-3C-67-4D-D5-70-28-76-60-96-68-BF-FB-CD-49-E0-8A-7C-6F-76-06-48-6D-63-67-8A-47-82-5E-7F-0E-AC-46-B6-BC-0A-6D-E2-1A-3A-20-A5-C7-81-71-6E-2B-16-97-D4-FA-C0-DD-72-5B-9F-A3-43-F4-85-B1-C6-A8-E0-62-81-5D-A5-07-29-6A-6A-2D-E1-1D-BE-12-6D-42-58-6F-4E-30-3D-BF-32-11-38-BC-36-76-60-FC-57-2F-D3-9E-C4-1A-92-EA-DE-85-FD-E7-AA-30-A6-97-2C-36-3B-3B-0E-92-52-FF-42-D7-62-6C-C1-3A-E7-1B-4E-13-8C-95-B3-4B-A7-9E-42-75-A8-CA-63-76-C4-45-74-96-43-D8-86-82-BE-37-FF-9B-EB-B7-18-A1-2F-E3-6C-08-E8-11-96-8C-5E-9E-2B-E7-DB-7D-54-E1-DB-1E-D3-8F-B5-19-4B-B2-16-DB-CF-EC-88-0B-6C-3C-E4-F2-C4-FF-4D-3E-53-52-3A-81-0B-6E-AC-95-EA-5A-6E-4D-83-23-82-C9-90-02-74-10-2A-6C-FB-97-4F-5F-70-8E-F0-B9"
-                               BitConverter.ToString (p8.EncryptedData));
-                       AssertEquals ("Salt", "86-2A-A9-71-6D-A4-B8-2D", BitConverter.ToString (p8.Salt));
-                       AssertEquals ("IterationCount", 2000, p8.IterationCount);
+                       Assert.AreEqual ("1.2.840.113549.1.12.1.3", p8.Algorithm, "Algorithm");
+                       Assert.AreEqual ("90-14-B5-F0-B6-86-56-CB-FA-63-AD-9F-5A-59-6C-AD-00-3C-37-8A-C3-88-58-8B-D7-48-53-7A-C8-5B-0D-98-DD-8B-B3-EC-4C-AC-61-18-E3-5E-47-AD-C7-92-BC-D3-00-07-FF-1A-68-74-45-8E-D8-7C-9F-18-7B-D7-C8-47-BA-6B-19-F2-BF-7E-51-0B-4B-43-E8-B9-56-7E-D0-74-C7-DE-76-DB-FF-5C-6B-53-BE-31-06-AE-6C-8F-DC-49-04-71-74-EE-B8-06-CB-AD-86-B4-4E-B9-46-A1-03-5E-0E-A7-C7-37-6B-B0-8D-2D-81-1F-E3-C2-05-DE-EF-51-07-70-6E-35-9A-AD-19-5E-AF-EB-7F-EF-E4-AB-07-F3-F6-EA-FA-0E-83-65-06-3C-F3-BD-96-08-14-C5-34-26-ED-C0-10-CC-AE-2D-8F-BE-ED-98-0D-88-1B-1E-C7-37-F0-FC-DB-3C-E3-1B-66-52-45-6E-05-A6-D9-12-23-05-5F-E3-9F-7D-21-9B-2E-3E-9E-3C-EE-D1-9B-55-DE-57-60-A5-24-2D-C7-94-EC-FC-B1-6A-65-BD-85-02-5C-58-AA-5A-6A-F3-AC-6B-DD-0E-63-B2-4B-5B-67-3D-C3-BF-E4-C8-EF-3F-89-5A-CD-6D-EF-05-22-2B-72-FF-80-7A-DD-F1-59-A7-6F-00-B1-BD-4D-88-D6-E4-8A-DD-A9-FC-D9-01-0A-65-8E-52-F9-7E-20-72-67-0D-5B-EE-67-5B-46-4A-15-A2-6F-15-2B-5B-9A-93-12-4F-F4-AD-49-D0-11-F1-7E-40-DE-32-96-2E-B3-E8-71-60-27-6E-A2-71-83-C7-FE-0E-8B-31-06-64-E1-19-02-B9-44-25-0C-94-64-7E-5F-89-4D-7E-99-0B-91-B8-22-A5-33-92-D3-49-07-1D-C6-25-4A-D7-6D-E2-94-3F-FA-10-72-59-62-F5-C6-D4-3A-EE-8F-BC-9C-BC-FC-C7-37-BF-7C-A0-67-B0-FF-0F-29-A0-A2-71-6B-21-00-F4-54-D9-3D-1B-CE-F4-FE-6F-F5-21-CB-47-58-17-F6-45-2F-A0-3B-8B-D9-B8-8A-33-3F-16-E0-C7-8A-B8-11-2F-A8-7E-7D-A7-7B-65-27-89-3C-67-4D-D5-70-28-76-60-96-68-BF-FB-CD-49-E0-8A-7C-6F-76-06-48-6D-63-67-8A-47-82-5E-7F-0E-AC-46-B6-BC-0A-6D-E2-1A-3A-20-A5-C7-81-71-6E-2B-16-97-D4-FA-C0-DD-72-5B-9F-A3-43-F4-85-B1-C6-A8-E0-62-81-5D-A5-07-29-6A-6A-2D-E1-1D-BE-12-6D-42-58-6F-4E-30-3D-BF-32-11-38-BC-36-76-60-FC-57-2F-D3-9E-C4-1A-92-EA-DE-85-FD-E7-AA-30-A6-97-2C-36-3B-3B-0E-92-52-FF-42-D7-62-6C-C1-3A-E7-1B-4E-13-8C-95-B3-4B-A7-9E-42-75-A8-CA-63-76-C4-45-74-96-43-D8-86-82-BE-37-FF-9B-EB-B7-18-A1-2F-E3-6C-08-E8-11-96-8C-5E-9E-2B-E7-DB-7D-54-E1-DB-1E-D3-8F-B5-19-4B-B2-16-DB-CF-EC-88-0B-6C-3C-E4-F2-C4-FF-4D-3E-53-52-3A-81-0B-6E-AC-95-EA-5A-6E-4D-83-23-82-C9-90-02-74-10-2A-6C-FB-97-4F-5F-70-8E-F0-B9", BitConverter.ToString (p8.EncryptedData)
+                               "EncryptedData");
+                       Assert.AreEqual ("86-2A-A9-71-6D-A4-B8-2D", BitConverter.ToString (p8.Salt), "Salt");
+                       Assert.AreEqual (2000, p8.IterationCount, "IterationCount");
                }
 
                static public byte[] End_Certificate_CP_01_01_crtx = { 0x30, 0x82, 0x02, 0x78, 0x02, 0x01, 0x00, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x02, 0x62, 0x30, 0x82, 0x02, 0x5E, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0xC6, 0x34, 0xEC, 0x6F, 0x0C, 0xE0, 0x59, 0x0E, 0xBC, 0x5F, 0xBA, 0x2E, 0x93, 0xBB, 0x04, 0xA7, 0x03, 0xB9, 0x70, 0x8A, 0xB9, 0xD7, 0xE5, 0xD7, 0xE6, 0xCA, 0x4A, 0x8C, 0x23, 0xD8, 0x60, 0xB3, 0x6B, 0xCB, 0x88, 0x88, 0xC7, 0xD8, 0x48, 0x7E, 0x64, 0xF9, 0xF6, 0x1B, 0xE3, 0x79, 0x46, 0x41, 0xE4, 0x61, 0xF7, 0x25, 0x47, 0x71, 0xF3, 0x50, 0x94, 0x4E, 0xF2, 0x7C, 0x6A, 0x37, 0xB6, 0x0C, 
@@ -68,25 +68,25 @@ namespace MonoTests.Mono.Security.Cryptography {
                [Test]
                public void PrivateKeyInfo_End_Certificate_CP_01_01 () 
                {
-                       AssertEquals ("PKCS8.GetType", PKCS8.KeyInfo.PrivateKey, PKCS8.GetType (End_Certificate_CP_01_01_crtx));
+                       Assert.AreEqual (PKCS8.KeyInfo.PrivateKey, PKCS8.GetType (End_Certificate_CP_01_01_crtx), "PKCS8.GetType");
                        PKCS8.PrivateKeyInfo p8 = new PKCS8.PrivateKeyInfo (End_Certificate_CP_01_01_crtx);
-                       AssertEquals ("Algorithm", "1.2.840.113549.1.1.1", p8.Algorithm);
-                       AssertEquals ("Attributes", 0, p8.Attributes.Count);
-                       AssertEquals ("PrivateKey", BitConverter.ToString (End_Certificate_CP_01_01_pki), BitConverter.ToString (p8.PrivateKey));
-                       AssertEquals ("Version", 0, p8.Version);
+                       Assert.AreEqual ("1.2.840.113549.1.1.1", p8.Algorithm, "Algorithm");
+                       Assert.AreEqual (0, p8.Attributes.Count, "Attributes");
+                       Assert.AreEqual (BitConverter.ToString (End_Certificate_CP_01_01_pki), BitConverter.ToString (p8.PrivateKey), "PrivateKey");
+                       Assert.AreEqual (0, p8.Version, "Version");
                }
 
                [Test]
                public void PrivateKeyInfo_End_Certificate_CP_01_02 () 
                {
                        PKCS8.PrivateKeyInfo p8 = new PKCS8.PrivateKeyInfo (End_Certificate_CP_01_02_crtx);
-                       AssertEquals ("Algorithm", "1.2.840.113549.1.1.1", p8.Algorithm);
-                       AssertEquals ("Attributes", 0, p8.Attributes.Count);
-                       AssertEquals ("PrivateKey", "30-82-02-5B-02-01-00-02-81-81-00-D6-39-9E-21-93-E2-BA-35-7F-E5-F8-E8-87-0B-8A-5F-28-25-85-B7-E5-CC-DA-7F-D3-C7-09-2A-63-E9-AD-8F-D0-A8-EF-BA-CF-3C-FB-55-03-B9-83-29-4E-0E-89-84-FB-E2-62-16-1F-9D-87-40-16-6B-F8-F4-66-38-58-74-67-D4-B5-A1-3A-4B-6F-13-4B-08-37-3A-3A-64-0A-06-8E-A2-7B-14-88-B7-F8-CE-6A-D1-45-9B-39-93-67-BF-0A-AB-DB-37-9D-FA-CE-54-0F-37-82-09-8F-0D-33-E4-B8-6E-46-C1-CC-4F-80-5A-B4-BD-19-80-27-40-84-49-02-03-01-00-01-02-81-80-14-95-5A-AD-4D-41-56-B4-F7-42-08-85-87-1C-43-C2-5A-E0-28-16-00-5D-8B-8D-06-B3-34-1D-3F-96-5F-57-D7-2B-B4-45-15-CE-7D-33-B0-F4-ED-36-55-CA-AD-C9-FA-4D-C9-30-E8-FE-C0-D5-16-92-6F-4C-44-5A-1B-9D-7E-AE-B8-01-6D-38-9D-DC-93-68-AB-93-D6-C0-8A-8A-63-B4-D6-DA-21-C1-A0-28-8C-24-C4-27-E1-4B-30-D2-2D-87-62-F9-17-75-21-5E-E1-3C-E2-2D-92-03-C6-A1-8D-1D-E9-67-F4-CE-FF-AC-52-86-D2-F5-0F-EB-03-01-02-41-00-ED-6A-AE-A7-33-B0-B8-86-36-91-BA-E7-D2-DD-15-3A-97-A2-66-31-98-24-A6-0D-E7-09-E3-BD-36-79-91-F2-5E-23-AA-21-C9-71-43-24-10-FA-F0-E6-FC-E4-C6-1F-08-45-E8-91-74-13-69-63-A5-40-8F-38-44-2B-54-69-02-41-00-E6-FE-39-8B-6F-DB-44-CA-E7-72-D3-CA-09-5B-3D-B1-53-85-29-36-FC-F1-B9-D8-1F-64-02-D4-F7-F5-71-E5-9F-17-D7-F3-9F-5A-3A-A6-A3-62-46-F6-93-3D-D3-CD-18-F2-12-BD-68-02-AA-91-55-DA-64-26-D7-16-34-E1-02-40-60-3F-F4-C8-72-4B-3D-B3-A3-A1-D6-FD-2E-DE-54-41-E9-C1-7B-DE-B5-48-7E-4D-7A-91-E6-D3-09-A7-A5-84-75-A7-CD-CC-5E-C7-5D-29-DC-FC-6E-F7-A6-24-F5-31-15-80-89-F5-95-F2-5C-B2-7A-07-3F-48-D7-52-1D-A9-02-40-40-1B-FC-C2-9B-57-E2-DE-E1-9F-B7-F2-11-E8-B5-D5-9A-55-91-DB-C6-16-1C-BB-43-F3-10-EA-24-AB-85-61-F2-66-BE-B3-C9-DD-53-FB-DD-CA-AF-E1-4D-7A-52-67-50-EE-16-8F-64-E7-A0-89-57-A7-96-36-45-69-CF-61-02-40-3D-9E-E3-29-D6-BD-59-FF-A5-C3-AC-57-CB-74-FE-B0-C3-67-34-A8-40-EB-04-88-C3-C2-74-4F-69-77-13-48-8A-97-3C-C2-4B-CD-E8-E0-97-98-A2-3F-B6-E2-71-D3-65-9F-5A-C6-C8-AE-FE-BA-B1-ED-DA-08-8A-5B-7B-12", BitConverter.ToString (p8.PrivateKey));
-                       AssertEquals ("Version", 0, p8.Version);
+                       Assert.AreEqual ("1.2.840.113549.1.1.1", p8.Algorithm, "Algorithm");
+                       Assert.AreEqual (0, p8.Attributes.Count, "Attributes");
+                       Assert.AreEqual ("30-82-02-5B-02-01-00-02-81-81-00-D6-39-9E-21-93-E2-BA-35-7F-E5-F8-E8-87-0B-8A-5F-28-25-85-B7-E5-CC-DA-7F-D3-C7-09-2A-63-E9-AD-8F-D0-A8-EF-BA-CF-3C-FB-55-03-B9-83-29-4E-0E-89-84-FB-E2-62-16-1F-9D-87-40-16-6B-F8-F4-66-38-58-74-67-D4-B5-A1-3A-4B-6F-13-4B-08-37-3A-3A-64-0A-06-8E-A2-7B-14-88-B7-F8-CE-6A-D1-45-9B-39-93-67-BF-0A-AB-DB-37-9D-FA-CE-54-0F-37-82-09-8F-0D-33-E4-B8-6E-46-C1-CC-4F-80-5A-B4-BD-19-80-27-40-84-49-02-03-01-00-01-02-81-80-14-95-5A-AD-4D-41-56-B4-F7-42-08-85-87-1C-43-C2-5A-E0-28-16-00-5D-8B-8D-06-B3-34-1D-3F-96-5F-57-D7-2B-B4-45-15-CE-7D-33-B0-F4-ED-36-55-CA-AD-C9-FA-4D-C9-30-E8-FE-C0-D5-16-92-6F-4C-44-5A-1B-9D-7E-AE-B8-01-6D-38-9D-DC-93-68-AB-93-D6-C0-8A-8A-63-B4-D6-DA-21-C1-A0-28-8C-24-C4-27-E1-4B-30-D2-2D-87-62-F9-17-75-21-5E-E1-3C-E2-2D-92-03-C6-A1-8D-1D-E9-67-F4-CE-FF-AC-52-86-D2-F5-0F-EB-03-01-02-41-00-ED-6A-AE-A7-33-B0-B8-86-36-91-BA-E7-D2-DD-15-3A-97-A2-66-31-98-24-A6-0D-E7-09-E3-BD-36-79-91-F2-5E-23-AA-21-C9-71-43-24-10-FA-F0-E6-FC-E4-C6-1F-08-45-E8-91-74-13-69-63-A5-40-8F-38-44-2B-54-69-02-41-00-E6-FE-39-8B-6F-DB-44-CA-E7-72-D3-CA-09-5B-3D-B1-53-85-29-36-FC-F1-B9-D8-1F-64-02-D4-F7-F5-71-E5-9F-17-D7-F3-9F-5A-3A-A6-A3-62-46-F6-93-3D-D3-CD-18-F2-12-BD-68-02-AA-91-55-DA-64-26-D7-16-34-E1-02-40-60-3F-F4-C8-72-4B-3D-B3-A3-A1-D6-FD-2E-DE-54-41-E9-C1-7B-DE-B5-48-7E-4D-7A-91-E6-D3-09-A7-A5-84-75-A7-CD-CC-5E-C7-5D-29-DC-FC-6E-F7-A6-24-F5-31-15-80-89-F5-95-F2-5C-B2-7A-07-3F-48-D7-52-1D-A9-02-40-40-1B-FC-C2-9B-57-E2-DE-E1-9F-B7-F2-11-E8-B5-D5-9A-55-91-DB-C6-16-1C-BB-43-F3-10-EA-24-AB-85-61-F2-66-BE-B3-C9-DD-53-FB-DD-CA-AF-E1-4D-7A-52-67-50-EE-16-8F-64-E7-A0-89-57-A7-96-36-45-69-CF-61-02-40-3D-9E-E3-29-D6-BD-59-FF-A5-C3-AC-57-CB-74-FE-B0-C3-67-34-A8-40-EB-04-88-C3-C2-74-4F-69-77-13-48-8A-97-3C-C2-4B-CD-E8-E0-97-98-A2-3F-B6-E2-71-D3-65-9F-5A-C6-C8-AE-FE-BA-B1-ED-DA-08-8A-5B-7B-12", BitConverter.ToString (p8.PrivateKey), "PrivateKey");
+                       Assert.AreEqual (0, p8.Version, "Version");
                        // static
                        RSA rsa = PKCS8.PrivateKeyInfo.DecodeRSA (p8.PrivateKey);
-                       AssertEquals ("DecodeRSA", "<RSAKeyValue><Modulus>1jmeIZPiujV/5fjohwuKXyglhbflzNp/08cJKmPprY/QqO+6zzz7VQO5gylODomE++JiFh+dh0AWa/j0ZjhYdGfUtaE6S28TSwg3OjpkCgaOonsUiLf4zmrRRZs5k2e/CqvbN536zlQPN4IJjw0z5LhuRsHMT4BatL0ZgCdAhEk=</Modulus><Exponent>AQAB</Exponent><P>7WqupzOwuIY2kbrn0t0VOpeiZjGYJKYN5wnjvTZ5kfJeI6ohyXFDJBD68Ob85MYfCEXokXQTaWOlQI84RCtUaQ==</P><Q>5v45i2/bRMrnctPKCVs9sVOFKTb88bnYH2QC1Pf1ceWfF9fzn1o6pqNiRvaTPdPNGPISvWgCqpFV2mQm1xY04Q==</Q><DP>YD/0yHJLPbOjodb9Lt5UQenBe961SH5NepHm0wmnpYR1p83MXsddKdz8bvemJPUxFYCJ9ZXyXLJ6Bz9I11IdqQ==</DP><DQ>QBv8wptX4t7hn7fyEei11ZpVkdvGFhy7Q/MQ6iSrhWHyZr6zyd1T+93Kr+FNelJnUO4Wj2TnoIlXp5Y2RWnPYQ==</DQ><InverseQ>PZ7jKda9Wf+lw6xXy3T+sMNnNKhA6wSIw8J0T2l3E0iKlzzCS83o4JeYoj+24nHTZZ9axsiu/rqx7doIilt7Eg==</InverseQ><D>FJVarU1BVrT3QgiFhxxDwlrgKBYAXYuNBrM0HT+WX1fXK7RFFc59M7D07TZVyq3J+k3JMOj+wNUWkm9MRFobnX6uuAFtOJ3ck2irk9bAiopjtNbaIcGgKIwkxCfhSzDSLYdi+Rd1IV7hPOItkgPGoY0d6Wf0zv+sUobS9Q/rAwE=</D></RSAKeyValue>", rsa.ToXmlString (true));
+                       Assert.AreEqual ("<RSAKeyValue><Modulus>1jmeIZPiujV/5fjohwuKXyglhbflzNp/08cJKmPprY/QqO+6zzz7VQO5gylODomE++JiFh+dh0AWa/j0ZjhYdGfUtaE6S28TSwg3OjpkCgaOonsUiLf4zmrRRZs5k2e/CqvbN536zlQPN4IJjw0z5LhuRsHMT4BatL0ZgCdAhEk=</Modulus><Exponent>AQAB</Exponent><P>7WqupzOwuIY2kbrn0t0VOpeiZjGYJKYN5wnjvTZ5kfJeI6ohyXFDJBD68Ob85MYfCEXokXQTaWOlQI84RCtUaQ==</P><Q>5v45i2/bRMrnctPKCVs9sVOFKTb88bnYH2QC1Pf1ceWfF9fzn1o6pqNiRvaTPdPNGPISvWgCqpFV2mQm1xY04Q==</Q><DP>YD/0yHJLPbOjodb9Lt5UQenBe961SH5NepHm0wmnpYR1p83MXsddKdz8bvemJPUxFYCJ9ZXyXLJ6Bz9I11IdqQ==</DP><DQ>QBv8wptX4t7hn7fyEei11ZpVkdvGFhy7Q/MQ6iSrhWHyZr6zyd1T+93Kr+FNelJnUO4Wj2TnoIlXp5Y2RWnPYQ==</DQ><InverseQ>PZ7jKda9Wf+lw6xXy3T+sMNnNKhA6wSIw8J0T2l3E0iKlzzCS83o4JeYoj+24nHTZZ9axsiu/rqx7doIilt7Eg==</InverseQ><D>FJVarU1BVrT3QgiFhxxDwlrgKBYAXYuNBrM0HT+WX1fXK7RFFc59M7D07TZVyq3J+k3JMOj+wNUWkm9MRFobnX6uuAFtOJ3ck2irk9bAiopjtNbaIcGgKIwkxCfhSzDSLYdi+Rd1IV7hPOItkgPGoY0d6Wf0zv+sUobS9Q/rAwE=</D></RSAKeyValue>", rsa.ToXmlString (true), "DecodeRSA");
                }
 
                [Test]
@@ -109,31 +109,31 @@ namespace MonoTests.Mono.Security.Cryptography {
                public void PrivateKeyInfo () 
                {
                        PKCS8.PrivateKeyInfo p8 = new PKCS8.PrivateKeyInfo ();
-                       AssertNull ("Default-Algorithm", p8.Algorithm);
-                       AssertEquals ("Default-Attributes", 0, p8.Attributes.Count);
-                       AssertNull ("Default-PrivateKey", p8.PrivateKey);
-                       AssertEquals ("Default-Version", 0, p8.Version);
+                       Assert.IsNull (p8.Algorithm, "Default-Algorithm");
+                       Assert.AreEqual (0, p8.Attributes.Count, "Default-Attributes");
+                       Assert.IsNull (p8.PrivateKey, "Default-PrivateKey");
+                       Assert.AreEqual (0, p8.Version, "Default-Version");
                        
                        byte[] key = new byte [8];
                        p8.Algorithm = "1.2.3.4.5";
                        p8.Attributes.Add (new ASN1 (0x05)); // NULL
                        p8.PrivateKey = key;
                        p8.Version = 1;
-                       AssertEquals ("Algorithm", "1.2.3.4.5", p8.Algorithm);
-                       AssertEquals ("Attributes", 1, p8.Attributes.Count);
-                       AssertEquals ("PrivateKey", 8, p8.PrivateKey.Length);
-                       AssertEquals ("Version", 1, p8.Version);
+                       Assert.AreEqual ("1.2.3.4.5", p8.Algorithm, "Algorithm");
+                       Assert.AreEqual (1, p8.Attributes.Count, "Attributes");
+                       Assert.AreEqual (8, p8.PrivateKey.Length, "PrivateKey");
+                       Assert.AreEqual (1, p8.Version, "Version");
                        
                        key [0] = 1;
-                       AssertEquals ("PrivateKey not directly accessible", 0, p8.PrivateKey [0]);
+                       Assert.AreEqual (0, p8.PrivateKey [0], "PrivateKey not directly accessible");
                        
                        byte[] p8pki = p8.GetBytes ();
                        
                        PKCS8.PrivateKeyInfo decoded = new PKCS8.PrivateKeyInfo (p8pki);
-                       AssertEquals ("Decoded-Algorithm", "1.2.3.4.5", decoded.Algorithm);
-                       AssertEquals ("Decoded-Attributes", 1, decoded.Attributes.Count);
-                       AssertEquals ("Decoded-PrivateKey", 8, decoded.PrivateKey.Length);
-                       AssertEquals ("Decoded-Version", 1, decoded.Version);
+                       Assert.AreEqual ("1.2.3.4.5", decoded.Algorithm, "Decoded-Algorithm");
+                       Assert.AreEqual (1, decoded.Attributes.Count, "Decoded-Attributes");
+                       Assert.AreEqual (8, decoded.PrivateKey.Length, "Decoded-PrivateKey");
+                       Assert.AreEqual (1, decoded.Version, "Decoded-Version");
                }
                
                [Test]
index ba0f403e8a78b8a23117ec43c446fa1ec60b3240..ef27bd73630b3446ad88310a6591eb3ba0d5d741 100644 (file)
@@ -17,7 +17,7 @@ using NUnit.Framework;
 namespace MonoTests.Mono.Security.Protocol.Ntlm {
 
        [TestFixture]
-       public class ChallengeResponseTest : Assertion {
+       public class ChallengeResponseTest {
 
                [Test]
                // Example from http://www.innovation.ch/java/ntlm.html
@@ -25,8 +25,8 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        byte[] SrvNonce = Encoding.ASCII.GetBytes ("SrvNonce");
                        using (ChallengeResponse ntlm = new ChallengeResponse ("Beeblebrox", SrvNonce)) {
-                               AssertEquals ("NT", "E0-E0-0D-E3-10-4A-1B-F2-05-3F-07-C7-DD-A8-2D-3C-48-9A-E9-89-E1-B0-00-D3", BitConverter.ToString (ntlm.NT));
-                               AssertEquals ("LM", "AD-87-CA-6D-EF-E3-46-85-B9-C4-3C-47-7A-8C-42-D6-00-66-7D-68-92-E7-E8-97", BitConverter.ToString (ntlm.LM));
+                               Assert.AreEqual ("E0-E0-0D-E3-10-4A-1B-F2-05-3F-07-C7-DD-A8-2D-3C-48-9A-E9-89-E1-B0-00-D3", BitConverter.ToString (ntlm.NT), "NT");
+                               Assert.AreEqual ("AD-87-CA-6D-EF-E3-46-85-B9-C4-3C-47-7A-8C-42-D6-00-66-7D-68-92-E7-E8-97", BitConverter.ToString (ntlm.LM), "LM");
                        }
                }
 
@@ -36,8 +36,8 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        byte[] SrvNonce = new byte [8] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
                        using (ChallengeResponse ntlm = new ChallengeResponse ("WELCOME", SrvNonce)) {
-                               AssertEquals ("NT", "7A-CE-90-85-AB-CC-37-59-38-0B-1C-68-62-E3-98-C3-C0-EF-9C-FC-22-E8-A2-C2", BitConverter.ToString (ntlm.NT));
-                               AssertEquals ("LM", "CA-12-00-72-3C-41-D5-77-AB-18-C7-64-C6-DE-F3-4F-A6-1B-FA-06-71-EA-5F-C8", BitConverter.ToString (ntlm.LM));
+                               Assert.AreEqual ("7A-CE-90-85-AB-CC-37-59-38-0B-1C-68-62-E3-98-C3-C0-EF-9C-FC-22-E8-A2-C2", BitConverter.ToString (ntlm.NT), "NT");
+                               Assert.AreEqual ("CA-12-00-72-3C-41-D5-77-AB-18-C7-64-C6-DE-F3-4F-A6-1B-FA-06-71-EA-5F-C8", BitConverter.ToString (ntlm.LM), "LM");
                        }
                }
 
@@ -46,9 +46,9 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        byte[] SrvNonce = new byte [8] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
                        using (ChallengeResponse ntlm = new ChallengeResponse (null, SrvNonce)) {
-                               AssertEquals ("NT", "4A-FD-81-EC-01-87-E8-8D-97-77-8D-F7-93-C6-DA-D4-F0-3A-36-63-66-9D-20-1C", BitConverter.ToString (ntlm.NT));
+                               Assert.AreEqual ("4A-FD-81-EC-01-87-E8-8D-97-77-8D-F7-93-C6-DA-D4-F0-3A-36-63-66-9D-20-1C", BitConverter.ToString (ntlm.NT), "NT");
                                // note the last 8 bytes... they are the same as the previous unit test ;-)
-                               AssertEquals ("LM", "0A-39-2B-11-CF-05-2B-02-6D-65-CF-F5-68-BD-E4-15-A6-1B-FA-06-71-EA-5F-C8", BitConverter.ToString (ntlm.LM));
+                               Assert.AreEqual ("0A-39-2B-11-CF-05-2B-02-6D-65-CF-F5-68-BD-E4-15-A6-1B-FA-06-71-EA-5F-C8", BitConverter.ToString (ntlm.LM), "LM");
                        }
                }
 
@@ -58,8 +58,8 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                        byte[] SrvNonce = new byte [8] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
                        using (ChallengeResponse ntlm = new ChallengeResponse (String.Empty, SrvNonce)) {
                                // same as the previous one as this is the same (null/empty) password expressed diffently
-                               AssertEquals ("NT", "4A-FD-81-EC-01-87-E8-8D-97-77-8D-F7-93-C6-DA-D4-F0-3A-36-63-66-9D-20-1C", BitConverter.ToString (ntlm.NT));
-                               AssertEquals ("LM", "0A-39-2B-11-CF-05-2B-02-6D-65-CF-F5-68-BD-E4-15-A6-1B-FA-06-71-EA-5F-C8", BitConverter.ToString (ntlm.LM));
+                               Assert.AreEqual ("4A-FD-81-EC-01-87-E8-8D-97-77-8D-F7-93-C6-DA-D4-F0-3A-36-63-66-9D-20-1C", BitConverter.ToString (ntlm.NT), "NT");
+                               Assert.AreEqual ("0A-39-2B-11-CF-05-2B-02-6D-65-CF-F5-68-BD-E4-15-A6-1B-FA-06-71-EA-5F-C8", BitConverter.ToString (ntlm.LM), "LM");
                        }
                }
                
@@ -68,8 +68,8 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        ChallengeResponse ntlm = new ChallengeResponse ("Mono", new byte [8]);
                        // no out!
-                       AssertNull ("Password", ntlm.Password);
-                       AssertNull ("Challenge", ntlm.Challenge);
+                       Assert.IsNull (ntlm.Password, "Password");
+                       Assert.IsNull (ntlm.Challenge, "Challenge");
                }
                
                [Test] 
@@ -104,7 +104,7 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        ChallengeResponse ntlm = new ChallengeResponse ("Mono", new byte [8]);
                        ntlm.Dispose ();
-                       AssertNotNull ("NT", ntlm.NT);
+                       Assert.IsNotNull (ntlm.NT, "NT");
                }
 
                [Test] 
@@ -113,7 +113,7 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        ChallengeResponse ntlm = new ChallengeResponse ("Mono", new byte [8]);
                        ntlm.Dispose ();
-                       AssertNotNull ("LM", ntlm.LM);
+                       Assert.IsNotNull (ntlm.LM, "LM");
                }
        }
 }
index 7164640be9b3d900fa1ac0ef05005fa76a8d4e9b..a02816fadc7542c256c2a71d3d7dcac870eda17d 100644 (file)
@@ -15,7 +15,7 @@ using NUnit.Framework;
 namespace MonoTests.Mono.Security.Protocol.Ntlm {
 
        [TestFixture]
-       public class MessageBaseTest : Assertion {
+       public class MessageBaseTest {
        
                // 
        
@@ -42,4 +42,4 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                }
 
        }
-}
\ No newline at end of file
+}
index c6dc2394d9393ce12cdb6746a6589f34d02ca375..5bd097e1d489536dcf85eb6931663b6099fd49f3 100644 (file)
@@ -16,17 +16,17 @@ using NUnit.Framework;
 namespace MonoTests.Mono.Security.Protocol.Ntlm {
 
        [TestFixture]
-       public class Type1MessageTest : Assertion {
+       public class Type1MessageTest {
 
                [Test]
                // Example from http://www.innovation.ch/java/ntlm.html
                public void Encode1 () 
                {
                        Type1Message msg = new Type1Message ();
-                       AssertEquals ("Type", 1, msg.Type);
+                       Assert.AreEqual (1, msg.Type, "Type");
                        msg.Domain = "Ursa-Minor";
                        msg.Host = "LightCity";
-                       AssertEquals ("GetBytes", "4E-54-4C-4D-53-53-50-00-01-00-00-00-07-B2-00-00-0A-00-0A-00-29-00-00-00-09-00-09-00-20-00-00-00-4C-49-47-48-54-43-49-54-59-55-52-53-41-2D-4D-49-4E-4F-52", BitConverter.ToString (msg.GetBytes ()));
+                       Assert.AreEqual ("4E-54-4C-4D-53-53-50-00-01-00-00-00-07-B2-00-00-0A-00-0A-00-29-00-00-00-09-00-09-00-20-00-00-00-4C-49-47-48-54-43-49-54-59-55-52-53-41-2D-4D-49-4E-4F-52", BitConverter.ToString (msg.GetBytes ()), "GetBytes");
                }
 
                [Test]
@@ -35,10 +35,10 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        byte[] data = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0xb2, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x29, 0x00, 0x00, 0x00, 0x09, 0x00, 0x09, 0x00, 0x20, 0x00, 0x00, 0x00, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x43, 0x49, 0x54, 0x59, 0x55, 0x52, 0x53, 0x41, 0x2d, 0x4d, 0x49, 0x4e, 0x4f, 0x52 };
                        Type1Message msg = new Type1Message (data);
-                       AssertEquals ("Domain", "URSA-MINOR", msg.Domain);
-                       AssertEquals ("Flags", (NtlmFlags)0xb203, msg.Flags);
-                       AssertEquals ("Host", "LIGHTCITY", msg.Host);
-                       AssertEquals ("Type", 1, msg.Type);
+                       Assert.AreEqual ("URSA-MINOR", msg.Domain, "Domain");
+                       Assert.AreEqual ((NtlmFlags)0xb203, msg.Flags, "Flags");
+                       Assert.AreEqual ("LIGHTCITY", msg.Host, "Host");
+                       Assert.AreEqual (1, msg.Type, "Type");
                }
 
                [Test]
@@ -47,10 +47,10 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        byte[] data = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x32, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x0b, 0x00, 0x20, 0x00, 0x00, 0x00, 0x57, 0x4f, 0x52, 0x4b, 0x53, 0x54, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x44, 0x4f, 0x4d, 0x41, 0x49, 0x4e };
                        Type1Message msg = new Type1Message (data);
-                       AssertEquals ("Domain", "DOMAIN", msg.Domain);
-                       AssertEquals ("Flags", (NtlmFlags)0x3207, msg.Flags);
-                       AssertEquals ("Host", "WORKSTATION", msg.Host);
-                       AssertEquals ("Type", 1, msg.Type);
+                       Assert.AreEqual ("DOMAIN", msg.Domain, "Domain");
+                       Assert.AreEqual ((NtlmFlags)0x3207, msg.Flags, "Flags");
+                       Assert.AreEqual ("WORKSTATION", msg.Host, "Host");
+                       Assert.AreEqual (1, msg.Type, "Type");
                }
        }
 }
index bd1b38349a35d8eade0e4cd808ad1bdd56060188..6233e0fe7555d76f028e809f0295ea67864a6110 100644 (file)
@@ -17,7 +17,7 @@ using NUnit.Framework;
 namespace MonoTests.Mono.Security.Protocol.Ntlm {
 
        [TestFixture]
-       public class Type2MessageTest : Assertion {
+       public class Type2MessageTest {
 
                static byte[] nonce = { 0x53, 0x72, 0x76, 0x4e, 0x6f, 0x6e, 0x63, 0x65 };
 
@@ -26,9 +26,9 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                public void Encode1 () 
                {
                        Type2Message msg = new Type2Message ();
-                       AssertEquals ("Type", 2, msg.Type);
+                       Assert.AreEqual (2, msg.Type, "Type");
                        msg.Nonce = nonce;
-                       AssertEquals ("GetBytes", "4E-54-4C-4D-53-53-50-00-02-00-00-00-00-00-00-00-28-00-00-00-01-82-00-00-53-72-76-4E-6F-6E-63-65-00-00-00-00-00-00-00-00", BitConverter.ToString (msg.GetBytes ()));
+                       Assert.AreEqual ("4E-54-4C-4D-53-53-50-00-02-00-00-00-00-00-00-00-28-00-00-00-01-82-00-00-53-72-76-4E-6F-6E-63-65-00-00-00-00-00-00-00-00", BitConverter.ToString (msg.GetBytes ()), "GetBytes");
                }
 
                [Test]
@@ -37,9 +37,9 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        byte[] data = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x82, 0x00, 0x00, 0x53, 0x72, 0x76, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                        Type2Message msg = new Type2Message (data);
-                       AssertEquals ("Flags", (NtlmFlags)0x8201, msg.Flags);
-                       AssertEquals ("Nonce", BitConverter.ToString (nonce), BitConverter.ToString (msg.Nonce));
-                       AssertEquals ("Type", 2, msg.Type);
+                       Assert.AreEqual ((NtlmFlags)0x8201, msg.Flags, "Flags");
+                       Assert.AreEqual (BitConverter.ToString (nonce), BitConverter.ToString (msg.Nonce), "Nonce");
+                       Assert.AreEqual (2, msg.Type, "Type");
                }
 
                [Test]
@@ -48,9 +48,9 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                {
                        byte[] data = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x02, 0x81, 0x00, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x00, 0x62, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x41, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x41, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x01, 0x00, 0x0c, 0x00, 0x53, 0x00, 0x45, 0x00, 0x52, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x04, 0x00, 0x14, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x03, 0x00, 0x22, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x2e, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00 };
                        Type2Message msg = new Type2Message (data);
-                       AssertEquals ("Flags", (NtlmFlags)0x00810201, msg.Flags);
-                       AssertEquals ("Nonce", "01-23-45-67-89-AB-CD-EF", BitConverter.ToString (msg.Nonce));
-                       AssertEquals ("Type", 2, msg.Type);
+                       Assert.AreEqual ((NtlmFlags)0x00810201, msg.Flags, "Flags");
+                       Assert.AreEqual ("01-23-45-67-89-AB-CD-EF", BitConverter.ToString (msg.Nonce), "Nonce");
+                       Assert.AreEqual (2, msg.Type, "Type");
                }
                
                [Test]
index febcb79755259ea869d3b4848d4cf458fab55bf8..e9343cc979f81b700f488fca84f1f487531308eb 100644 (file)
@@ -17,7 +17,7 @@ using NUnit.Framework;
 namespace MonoTests.Mono.Security.Protocol.Ntlm {
 
        [TestFixture]
-       public class Type3MessageTest : Assertion {
+       public class Type3MessageTest {
 
                static byte[] nonce = { 0x53, 0x72, 0x76, 0x4e, 0x6f, 0x6e, 0x63, 0x65 };
 
@@ -40,8 +40,8 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                        msg.Host = "HOST";
                        msg.Password = "WELCOME";
                        msg.Username = "username";
-                       AssertEquals ("Type", 3, msg.Type);
-                       AssertEquals ("GetBytes", "4E-54-4C-4D-53-53-50-00-03-00-00-00-18-00-18-00-64-00-00-00-18-00-18-00-7C-00-00-00-0C-00-0C-00-40-00-00-00-10-00-10-00-4C-00-00-00-08-00-08-00-5C-00-00-00-00-00-00-00-94-00-00-00-01-B2-00-00-44-00-4F-00-4D-00-41-00-49-00-4E-00-75-00-73-00-65-00-72-00-6E-00-61-00-6D-00-65-00-48-00-4F-00-53-00-54-00-CA-12-00-72-3C-41-D5-77-AB-18-C7-64-C6-DE-F3-4F-A6-1B-FA-06-71-EA-5F-C8-7A-CE-90-85-AB-CC-37-59-38-0B-1C-68-62-E3-98-C3-C0-EF-9C-FC-22-E8-A2-C2", BitConverter.ToString (msg.GetBytes ()));
+                       Assert.AreEqual (3, msg.Type, "Type");
+                       Assert.AreEqual ("4E-54-4C-4D-53-53-50-00-03-00-00-00-18-00-18-00-64-00-00-00-18-00-18-00-7C-00-00-00-0C-00-0C-00-40-00-00-00-10-00-10-00-4C-00-00-00-08-00-08-00-5C-00-00-00-00-00-00-00-94-00-00-00-01-B2-00-00-44-00-4F-00-4D-00-41-00-49-00-4E-00-75-00-73-00-65-00-72-00-6E-00-61-00-6D-00-65-00-48-00-4F-00-53-00-54-00-CA-12-00-72-3C-41-D5-77-AB-18-C7-64-C6-DE-F3-4F-A6-1B-FA-06-71-EA-5F-C8-7A-CE-90-85-AB-CC-37-59-38-0B-1C-68-62-E3-98-C3-C0-EF-9C-FC-22-E8-A2-C2", BitConverter.ToString (msg.GetBytes ()), "GetBytes");
                }
 
                [Test]
@@ -55,8 +55,8 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                        msg.Host = "LIGHTCITY";
                        msg.Password = "Beeblebrox";
                        msg.Username = "Zaphod";
-                       AssertEquals ("Type", 3, msg.Type);
-                       AssertEquals ("GetBytes", "4E-54-4C-4D-53-53-50-00-03-00-00-00-18-00-18-00-72-00-00-00-18-00-18-00-8A-00-00-00-14-00-14-00-40-00-00-00-0C-00-0C-00-54-00-00-00-12-00-12-00-60-00-00-00-00-00-00-00-A2-00-00-00-01-B2-00-00-55-00-52-00-53-00-41-00-2D-00-4D-00-49-00-4E-00-4F-00-52-00-5A-00-61-00-70-00-68-00-6F-00-64-00-4C-00-49-00-47-00-48-00-54-00-43-00-49-00-54-00-59-00-AD-87-CA-6D-EF-E3-46-85-B9-C4-3C-47-7A-8C-42-D6-00-66-7D-68-92-E7-E8-97-E0-E0-0D-E3-10-4A-1B-F2-05-3F-07-C7-DD-A8-2D-3C-48-9A-E9-89-E1-B0-00-D3", BitConverter.ToString (msg.GetBytes ()));
+                       Assert.AreEqual (3, msg.Type, "Type");
+                       Assert.AreEqual ("4E-54-4C-4D-53-53-50-00-03-00-00-00-18-00-18-00-72-00-00-00-18-00-18-00-8A-00-00-00-14-00-14-00-40-00-00-00-0C-00-0C-00-54-00-00-00-12-00-12-00-60-00-00-00-00-00-00-00-A2-00-00-00-01-B2-00-00-55-00-52-00-53-00-41-00-2D-00-4D-00-49-00-4E-00-4F-00-52-00-5A-00-61-00-70-00-68-00-6F-00-64-00-4C-00-49-00-47-00-48-00-54-00-43-00-49-00-54-00-59-00-AD-87-CA-6D-EF-E3-46-85-B9-C4-3C-47-7A-8C-42-D6-00-66-7D-68-92-E7-E8-97-E0-E0-0D-E3-10-4A-1B-F2-05-3F-07-C7-DD-A8-2D-3C-48-9A-E9-89-E1-B0-00-D3", BitConverter.ToString (msg.GetBytes ()), "GetBytes");
                }
 
                [Test]
@@ -64,14 +64,14 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                public void Decode1 () 
                {
                        Type3Message msg = new Type3Message (data1);
-                       AssertEquals ("Domain", "URSA-MINOR", msg.Domain);
-                       AssertEquals ("Host", "LIGHTCITY", msg.Host);
-                       AssertEquals ("Username", "Zaphod", msg.Username);
-                       AssertEquals ("Flags", (NtlmFlags)0x8201, msg.Flags);
-                       AssertEquals ("Type", 3, msg.Type);
-                       AssertNull ("Password", msg.Password);
-                       AssertEquals ("LM", "AD-87-CA-6D-EF-E3-46-85-B9-C4-3C-47-7A-8C-42-D6-00-66-7D-68-92-E7-E8-97", BitConverter.ToString (msg.LM));
-                       AssertEquals ("NT", "E0-E0-0D-E3-10-4A-1B-F2-05-3F-07-C7-DD-A8-2D-3C-48-9A-E9-89-E1-B0-00-D3", BitConverter.ToString (msg.NT));
+                       Assert.AreEqual ("URSA-MINOR", msg.Domain, "Domain");
+                       Assert.AreEqual ("LIGHTCITY", msg.Host, "Host");
+                       Assert.AreEqual ("Zaphod", msg.Username, "Username");
+                       Assert.AreEqual ((NtlmFlags)0x8201, msg.Flags, "Flags");
+                       Assert.AreEqual (3, msg.Type, "Type");
+                       Assert.IsNull (msg.Password, "Password");
+                       Assert.AreEqual ("AD-87-CA-6D-EF-E3-46-85-B9-C4-3C-47-7A-8C-42-D6-00-66-7D-68-92-E7-E8-97", BitConverter.ToString (msg.LM), "LM");
+                       Assert.AreEqual ("E0-E0-0D-E3-10-4A-1B-F2-05-3F-07-C7-DD-A8-2D-3C-48-9A-E9-89-E1-B0-00-D3", BitConverter.ToString (msg.NT), "NT");
                }
 
                [Test]
@@ -79,28 +79,28 @@ namespace MonoTests.Mono.Security.Protocol.Ntlm {
                public void Decode2 () 
                {
                        Type3Message msg = new Type3Message (data2);
-                       AssertEquals ("Domain", "DOMAIN", msg.Domain);
-                       AssertEquals ("Host", "WORKSTATION", msg.Host);
-                       AssertEquals ("Username", "user", msg.Username);
-                       AssertEquals ("Flags", (NtlmFlags)0x201, msg.Flags);
-                       AssertEquals ("Type", 3, msg.Type);
-                       AssertNull ("Password", msg.Password);
-                       AssertEquals ("LM", "C3-37-CD-5C-BD-44-FC-97-82-A6-67-AF-6D-42-7C-6D-E6-7C-20-C2-D3-E7-7C-56", BitConverter.ToString (msg.LM));
-                       AssertEquals ("NT", "25-A9-8C-1C-31-E8-18-47-46-6B-29-B2-DF-46-80-F3-99-58-FB-8C-21-3A-9C-C6", BitConverter.ToString (msg.NT));
+                       Assert.AreEqual ("DOMAIN", msg.Domain, "Domain");
+                       Assert.AreEqual ("WORKSTATION", msg.Host, "Host");
+                       Assert.AreEqual ("user", msg.Username, "Username");
+                       Assert.AreEqual ((NtlmFlags)0x201, msg.Flags, "Flags");
+                       Assert.AreEqual (3, msg.Type, "Type");
+                       Assert.IsNull (msg.Password, "Password");
+                       Assert.AreEqual ("C3-37-CD-5C-BD-44-FC-97-82-A6-67-AF-6D-42-7C-6D-E6-7C-20-C2-D3-E7-7C-56", BitConverter.ToString (msg.LM), "LM");
+                       Assert.AreEqual ("25-A9-8C-1C-31-E8-18-47-46-6B-29-B2-DF-46-80-F3-99-58-FB-8C-21-3A-9C-C6", BitConverter.ToString (msg.NT), "NT");
                }
 
                [Test]
                public void Challenge () 
                {
                        Type3Message msg = new Type3Message ();
-                       AssertNull ("Challenge", msg.Challenge);
+                       Assert.IsNull (msg.Challenge, "Challenge");
                        
                        byte[] c = new byte [8];
                        msg.Challenge = c;
-                       AssertEquals ("Challenge.Length", 8, msg.Challenge.Length);
+                       Assert.AreEqual (8, msg.Challenge.Length, "Challenge.Length");
                        
                        c [0] = 1;
-                       AssertEquals ("Challenge not directly accessible", 0, msg.Challenge [0]);
+                       Assert.AreEqual (0, msg.Challenge [0], "Challenge not directly accessible");
                }
                
                [Test]
index 05e013cd4aa2a26d7080df77256a51e636311396..fe94f26e01bcb9dd8663c2aeceb2686b9c3e4410 100644 (file)
@@ -22,7 +22,7 @@ namespace MonoTests.Mono.Security {
        // sn -k test.snk
 
        [TestFixture]
-       public class StrongNameTest : Assertion {
+       public class StrongNameTest {
 
                // because most crypto stuff works with byte[] buffers
                static public void AssertEquals (string msg, byte[] array1, byte[] array2) 
@@ -30,9 +30,9 @@ namespace MonoTests.Mono.Security {
                        if ((array1 == null) && (array2 == null))
                                return;
                        if (array1 == null)
-                               Fail (msg + " -> First array is NULL");
+                               Assert.Fail (msg + " -> First array is NULL");
                        if (array2 == null)
-                               Fail (msg + " -> Second array is NULL");
+                               Assert.Fail (msg + " -> Second array is NULL");
 
                        bool a = (array1.Length == array2.Length);
                        if (a) {
@@ -47,7 +47,7 @@ namespace MonoTests.Mono.Security {
                                msg += " -> Expected " + BitConverter.ToString (array1, 0);
                                msg += " is different than " + BitConverter.ToString (array2, 0);
                        }
-                       Assert (msg, a);
+                       Assert.IsTrue (a, msg);
                }
 
                static byte[] test = { 
@@ -112,9 +112,9 @@ namespace MonoTests.Mono.Security {
                public void FromBuffer ()
                {
                        StrongName sn = new StrongName (test);
-                       AssertEquals ("buffer.RSA", "<RSAKeyValue><Modulus>y6T/+EoARJMHW0ilpCdn+VbTffWxb1xu187/9Q+S2DwPyZ9LTNKrZgwaYmG4FPWEEH1HJxrxwh8AlD6oTz8CCcnPGKxKVFkubpIbEyvQCSTr22gUjVXXKHc2pfcCeOuNXS9kAOjv2tqpsiDbIsu9mnxfYysHWMDBqA4rxghyvT0=</Modulus><Exponent>AQAB</Exponent><P>6qYUEleRY+Wzyk7xN05UwWRna37U2aQnq2Y2VVyJeceDZPU1u1GYdQmFQw5XgvxKwWx9DAfNh1iSyLe0YmrAcw==</P><Q>3iy1IDIkPrRWBFrCAUhpUNn4/ICiVXTT7KjuEXkGr0+1Cx/V+o3eoVIo/9x2Q3IaxMbQDSa8hisIFunz/iuPjw==</Q><DP>2BouIBpfvzX8mBSOGNZePmG+0YRUeUCyfCs9XO5Fek9h1mfynVpvY1JqVbBuria2nl7Q53SEN+M+A/cT/RO9uw==</DP><DQ>pjma1ljNh2CTTrS8nAsaSJSc1gZD7l33RQRrAgWju7yN/qG2DbzhSZ9X7355uSKA5qK8/Gnz+QnvBn3JwGvE/w==</DQ><InverseQ>3U67bp3lPExfGoiTRvRyHhNtyJs6hAq/Uj7wSHKLHNoLG20kwZux8BwZKpPBBA0bQjkLUiRv9PYs18El/45/wA==</InverseQ><D>bPVOg5FMjWRBhmTbQ3ZWGkGLjRR9KEFDiTJXHs6DWjDgnZceWe9KB6KoJ0Vzkbs/Ovdcr56qBZxC2g6gTS5ALvogBYH2PrUftr4flh/z4qgOrAYCQkTecfHAGIGEldEeF1FItMbqmQa6WzVPVp4tn/+q3PAVmZqrs6/X9EARH10=</D></RSAKeyValue>", sn.RSA.ToXmlString (true));
-                       AssertEquals ("buffer.PublicKey", testPublicKey, sn.PublicKey);
-                       AssertEquals ("buffer.PublicKeyToken", testPublicKeyToken, sn.PublicKeyToken);
+                       Assert.AreEqual ("<RSAKeyValue><Modulus>y6T/+EoARJMHW0ilpCdn+VbTffWxb1xu187/9Q+S2DwPyZ9LTNKrZgwaYmG4FPWEEH1HJxrxwh8AlD6oTz8CCcnPGKxKVFkubpIbEyvQCSTr22gUjVXXKHc2pfcCeOuNXS9kAOjv2tqpsiDbIsu9mnxfYysHWMDBqA4rxghyvT0=</Modulus><Exponent>AQAB</Exponent><P>6qYUEleRY+Wzyk7xN05UwWRna37U2aQnq2Y2VVyJeceDZPU1u1GYdQmFQw5XgvxKwWx9DAfNh1iSyLe0YmrAcw==</P><Q>3iy1IDIkPrRWBFrCAUhpUNn4/ICiVXTT7KjuEXkGr0+1Cx/V+o3eoVIo/9x2Q3IaxMbQDSa8hisIFunz/iuPjw==</Q><DP>2BouIBpfvzX8mBSOGNZePmG+0YRUeUCyfCs9XO5Fek9h1mfynVpvY1JqVbBuria2nl7Q53SEN+M+A/cT/RO9uw==</DP><DQ>pjma1ljNh2CTTrS8nAsaSJSc1gZD7l33RQRrAgWju7yN/qG2DbzhSZ9X7355uSKA5qK8/Gnz+QnvBn3JwGvE/w==</DQ><InverseQ>3U67bp3lPExfGoiTRvRyHhNtyJs6hAq/Uj7wSHKLHNoLG20kwZux8BwZKpPBBA0bQjkLUiRv9PYs18El/45/wA==</InverseQ><D>bPVOg5FMjWRBhmTbQ3ZWGkGLjRR9KEFDiTJXHs6DWjDgnZceWe9KB6KoJ0Vzkbs/Ovdcr56qBZxC2g6gTS5ALvogBYH2PrUftr4flh/z4qgOrAYCQkTecfHAGIGEldEeF1FItMbqmQa6WzVPVp4tn/+q3PAVmZqrs6/X9EARH10=</D></RSAKeyValue>", sn.RSA.ToXmlString (true), "buffer.RSA");
+                       Assert.AreEqual (testPublicKey, sn.PublicKey, "buffer.PublicKey");
+                       Assert.AreEqual (testPublicKeyToken, sn.PublicKeyToken, "buffer.PublicKeyToken");
                }
 
                [Test]
@@ -122,9 +122,9 @@ namespace MonoTests.Mono.Security {
                {
                        StrongName sn1 = new StrongName (test);
                        StrongName sn2 = new StrongName (sn1.RSA);
-                       AssertEquals ("key.RSA", sn1.RSA.ToXmlString (true), sn2.RSA.ToXmlString (true));
-                       AssertEquals ("key.PublicKey", sn1.PublicKey, sn2.PublicKey);
-                       AssertEquals ("key.PublicKeyToken", sn1.PublicKeyToken, sn2.PublicKeyToken);
+                       Assert.AreEqual (sn1.RSA.ToXmlString (true), sn2.RSA.ToXmlString (true), "key.RSA");
+                       Assert.AreEqual (sn1.PublicKey, sn2.PublicKey, "key.PublicKey");
+                       Assert.AreEqual (sn1.PublicKeyToken, sn2.PublicKeyToken, "key.PublicKeyToken");
                }
 
                string Signed;
@@ -820,28 +820,28 @@ namespace MonoTests.Mono.Security {
                {
                        // compare that both hellosigned and hellodelay are the same file expect for signature
                        byte[] s = sn.Hash (Signed);
-                       AssertNotNull ("Hash/Signed", s);
+                       Assert.IsNotNull (s, "Hash/Signed");
                        byte[] d = sn.Hash (Delay);
-                       AssertNotNull ("Hash/Delay", d);
+                       Assert.IsNotNull (d, "Hash/Delay");
                        // are they the same
-                       AssertEquals ("Hash/Compare", s, d);
+                       Assert.AreEqual (s, d, "Hash/Compare");
                        // are they the same as GetHashFromAssemblyFile
                        byte[] knownHash = { 0x7D, 0xF7, 0x1D, 0xD4, 0x24, 0x22, 0xEA, 0xAB, 0xD2, 0x91, 0xCD, 0xAB, 0x1A, 0x55, 0x6A, 0x42, 0x05, 0xBA, 0x6E, 0x7B };
-                       AssertEquals ("Hash/GetHashFromAssemblyFile", knownHash, s);
+                       Assert.AreEqual (knownHash, s, "Hash/GetHashFromAssemblyFile");
                }
 
                [Test]
                public void VerifyValid () 
                {
                        // verify that hellosigned.exe is valid
-                       Assert ("Verify/Valid", sn.Verify (Signed));
+                       Assert.IsTrue (sn.Verify (Signed), "Verify/Valid");
                }
 
                [Test]
                public void VerifyInvalid () 
                {
                        // verify that hellodelay.exe isn't valid
-                       Assert ("Verify/Invalid", !sn.Verify (Delay));
+                       Assert.IsTrue (!sn.Verify (Delay), "Verify/Invalid");
                }
 
                [Test]
@@ -849,7 +849,7 @@ namespace MonoTests.Mono.Security {
                {
                        Stream signed = new MemoryStream (signedData);
                        // verify that hellosigned.exe is valid
-                       Assert ("Verify/Valid", sn.Verify (signed));
+                       Assert.IsTrue (sn.Verify (signed), "Verify/Valid");
                }
 
                [Test]
@@ -857,25 +857,25 @@ namespace MonoTests.Mono.Security {
                {
                        Stream delay = new MemoryStream (delayData);
                        // verify that hellodelay.exe isn't valid
-                       Assert ("Verify/Invalid", !sn.Verify (delay));
+                       Assert.IsTrue (!sn.Verify (delay), "Verify/Invalid");
                }
 
                [Test]
                public void Sign () 
                {
                        // sign the (invalid) hellodelay.exe
-                       Assert ("Sign", sn.Sign (Delay));
+                       Assert.IsTrue (sn.Sign (Delay), "Sign");
                        // and verify it's now valid
-                       Assert ("Sign/Verify", sn.Verify (Delay));
+                       Assert.IsTrue (sn.Verify (Delay), "Sign/Verify");
                }
 
                [Test]
                public void ReSign () 
                {
                        // resign the (already valid) hellosigned.exe
-                       Assert ("ReSign", sn.Sign (Signed));
+                       Assert.IsTrue (sn.Sign (Signed), "ReSign");
                        // and verify it's still valid
-                       Assert ("ReSign/Verify", sn.Verify (Signed));
+                       Assert.IsTrue (sn.Verify (Signed), "ReSign/Verify");
                }
                
                [Test]
@@ -907,7 +907,7 @@ namespace MonoTests.Mono.Security {
                {
                        byte[] ecma = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 
                        sn = new StrongName (ecma);
-                       Assert ("CanSign", !sn.CanSign);
+                       Assert.IsTrue (!sn.CanSign, "CanSign");
                }
 
                [Test]
index 8673fc48022bf86c218f9fbb97b6079e121206c1..66c126fd520bd656e795eea1109cf12028a27684 100644 (file)
@@ -447,7 +447,7 @@ namespace MonoTests.System.Data
                {
                        DataTable dt = DataProvider.CreateParentDataTable();
                        dt.Constraints.Add("UniqueConstraint",dt.Columns["ParentId"],true);
-                       Assert.AreEqual(1,dt.Constraints.Count,1); 
+                       Assert.AreEqual(1,(double) dt.Constraints.Count,1); 
                        Assert.AreEqual("UniqueConstraint",dt.Constraints[0].ConstraintName,"CN34");                    
                }
                
index 5b2fd8ca9f3d66c97964d7d1ae0b44fc596f32cd..e8487efaf6bc0cae842a9839adafe27c6a84960a 100644 (file)
@@ -41,7 +41,7 @@ using System.Data;
 namespace MonoTests.System.Data
 {
        [TestFixture]
-       public class DataRowTest : Assertion {
+       public class DataRowTest {
                private DataTable table;                                                
                 private DataRow row;    
 
@@ -101,7 +101,7 @@ namespace MonoTests.System.Data
                 private  void GetColumnErrorTest ()
                 {
                         // Print the error of a specified column.
-                        AssertEquals ("#A01", "Some error!", row.GetColumnError (1));
+                        Assert.AreEqual ("Some error!", row.GetColumnError (1), "#A01");
                 }
 
                 private void GetAllErrorsTest ()
@@ -112,7 +112,7 @@ namespace MonoTests.System.Data
                                 colArr = row.GetColumnsInError ();
                                                                                                     
                                 for (int i = 0; i < colArr.Length; i++) {
-                                        AssertEquals ("#A02", table.Columns [1], colArr [i]);
+                                        Assert.AreEqual (table.Columns [1], colArr [i], "#A02");
                                 }
                                 row.ClearErrors ();
                         }
@@ -135,7 +135,7 @@ namespace MonoTests.System.Data
                         int cnt = 1;
                         for (int i = 1; i < table.Rows.Count; i++) {
                                 DataRow r = table.Rows [i];
-                                AssertEquals ("#A03", "Name " + cnt, r ["fName"]);
+                                Assert.AreEqual ("Name " + cnt, r ["fName"], "#A03");
                                 cnt++;
                         }
                                                                                                     
@@ -146,20 +146,20 @@ namespace MonoTests.System.Data
                        rc [2].Delete ();
                                                                                                     
                                                                                                     
-                        AssertEquals ("#A04", "Deleted", rc [0].RowState.ToString ());
-                        AssertEquals ("#A05", "Deleted", rc [2].RowState.ToString ());
+                        Assert.AreEqual ("Deleted", rc [0].RowState.ToString (), "#A04");
+                        Assert.AreEqual ("Deleted", rc [2].RowState.ToString (), "#A05");
                                                                                                     
                                                                                                     
                         // Accept changes
                         table.AcceptChanges ();
-                        AssertEquals ("#A06", "Name 1", (table.Rows [0]) [1]);
+                        Assert.AreEqual ("Name 1", (table.Rows [0]) [1], "#A06");
                         try  {
                                 object o = rc [2];
-                                Fail ("#A07");
+                                Assert.Fail ("#A07");
                         }
                         catch (Exception e) {
                                // Never premise English.
-                                //AssertEquals ("#A08", "There is no row at position 2.", e.Message);
+                                //Assert.AreEqual ("#A08", "There is no row at position 2.", e.Message);
                         }
                 }
 
@@ -179,40 +179,40 @@ namespace MonoTests.System.Data
                                                                                                     
                                 // Stage 1
                                 //Initially: After Add (Row) But Before Accept Changes");
-                                AssertEquals ("#A09", "My FName", row [1, DataRowVersion.Default]);
-                                AssertEquals ("#A10", "LName", row [2, DataRowVersion.Default]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Default], "#A09");
+                                Assert.AreEqual ("LName", row [2, DataRowVersion.Default], "#A10");
                                                                                                     
-                                AssertEquals ("#A11", "My FName", row [1, DataRowVersion.Current]);
-                                AssertEquals ("#A12", "LName", row [2, DataRowVersion.Current]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Current], "#A11");
+                                Assert.AreEqual ("LName", row [2, DataRowVersion.Current], "#A12");
                                                                                                     
                                 try {
                                       object o = row [1, DataRowVersion.Original];
                                       o = row [1, DataRowVersion.Proposed];
-                                        Fail ("#A13");
+                                        Assert.Fail ("#A13");
                                 }
                                 catch (Exception e) {
                                         if (e.GetType () != typeof (AssertionException)) {
-                                                AssertEquals ("#A14", typeof (VersionNotFoundException), e.GetType ());
+                                                Assert.AreEqual (typeof (VersionNotFoundException), e.GetType (), "#A14");
                                         }
                                 }
                                                                                                     
                                 // Stage 2
                                 //After Accept Changes
                                 table.AcceptChanges ();
-                                AssertEquals ("#A15", "My FName", row [1, DataRowVersion.Default]);
-                                AssertEquals ("#A16", "LName", row [2, DataRowVersion.Default]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Default], "#A15");
+                                Assert.AreEqual ("LName", row [2, DataRowVersion.Default], "#A16");
                                                                                                     
                                                                                                     
-                                AssertEquals ("#A17", "My FName", row [1, DataRowVersion.Current]);
-                                AssertEquals ("#A18", "LName", row [2, DataRowVersion.Current]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Current], "#A17");
+                                Assert.AreEqual ("LName", row [2, DataRowVersion.Current], "#A18");
                                 
                                try {
                                       object o = row [1, DataRowVersion.Proposed];
-                                        Fail ("#A19");
+                                        Assert.Fail ("#A19");
                                 }
                                 catch (Exception e) {
                                         if (e.GetType () != typeof (AssertionException)) {
-                                                AssertEquals ("#A20", typeof (VersionNotFoundException), e.GetType ());
+                                                Assert.AreEqual (typeof (VersionNotFoundException), e.GetType (), "#A20");
                                         }
                                 }
                                                                                                     
@@ -221,63 +221,64 @@ namespace MonoTests.System.Data
                                 table.Rows [0].BeginEdit ();
                                 table.Rows [0] ["LName"] = "My LName";
                                                                                                     
-                                AssertEquals ("#A21", "My FName", row [1, DataRowVersion.Default]);
-                                AssertEquals ("#A22", "My LName", row [2, DataRowVersion.Default]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Default], "#A21");
+                                Assert.AreEqual ("My LName", row [2, DataRowVersion.Default], "#A22");
                                                                                                                                                                                                          
-                                AssertEquals ("#A23", "My FName", row [1, DataRowVersion.Current]);
-                                AssertEquals ("#A24", "LName", row [2, DataRowVersion.Current]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Current], "#A23");
+                                Assert.AreEqual ("LName", row [2, DataRowVersion.Current], "#A24");
                                                                                                     
                                                                                                     
-                                AssertEquals ("#A25", "My FName", row [1, DataRowVersion.Original]);                                AssertEquals ("#A26", "LName", row [2, DataRowVersion.Original]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Original], "#A25");
+                                Assert.AreEqual ("LName", row [2, DataRowVersion.Original], "#A26");
                                                                                                     
-                                AssertEquals ("#A26", "My FName", row [1, DataRowVersion.Proposed]);
-                               AssertEquals ("#A27", "My LName", row [2, DataRowVersion.Proposed]);                                                                                                    
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Proposed], "#A26");
+                                Assert.AreEqual ("My LName", row [2, DataRowVersion.Proposed], "#A27");                                                                                                    
                                                                                                     
                                                                                                     
                                 // Stage 4
                                 //After Edit sessions
                                 for (int i=0; i < table.Rows.Count;i++)
                                         table.Rows [i].EndEdit ();
-                                AssertEquals ("#A28", "My FName", row [1, DataRowVersion.Default]);
-                                AssertEquals ("#A29", "My LName", row [2, DataRowVersion.Default]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Default], "#A28");
+                                Assert.AreEqual ("My LName", row [2, DataRowVersion.Default], "#A29");
                                                                                                                                                                                                          
-                                AssertEquals ("#A30", "My FName", row [1, DataRowVersion.Original]);                                AssertEquals ("#A31", "LName", row [2, DataRowVersion.Original]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Original], "#A30");                                Assert.AreEqual ("LName", row [2, DataRowVersion.Original], "#A31");
                                                                                                     
                                                                                                     
-                                AssertEquals ("#A32", "My FName", row [1, DataRowVersion.Current]);
-                                AssertEquals ("#A33", "My LName", row [2, DataRowVersion.Current]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Current], "#A32");
+                                Assert.AreEqual ("My LName", row [2, DataRowVersion.Current], "#A33");
                                                                                                     
                                 try {
                                       object o = row [1, DataRowVersion.Proposed];
-                                        Fail ("#A34");
+                                        Assert.Fail ("#A34");
                                 }
                                 catch (Exception e) {
                                         if (e.GetType ()!=typeof (AssertionException)) {
-                                                AssertEquals ("#A35", typeof (VersionNotFoundException), e.GetType ());
+                                                Assert.AreEqual (typeof (VersionNotFoundException), e.GetType (), "#A35");
                                         }
                                 }
                                                                                                     
                                 //Stage 5
                                 //After Accept Changes
                                table.AcceptChanges ();
-                               AssertEquals ("#A36", "My FName", row [1, DataRowVersion.Default]);
-                                AssertEquals ("#A37", "My LName", row [2, DataRowVersion.Default]);
+                               Assert.AreEqual ("My FName", row [1, DataRowVersion.Default], "#A36");
+                                Assert.AreEqual ("My LName", row [2, DataRowVersion.Default], "#A37");
                                                                                                     
                                                                                                     
-                                AssertEquals ("#A38", "My FName", row [1, DataRowVersion.Original]);                                AssertEquals ("#A39", "My LName", row [2, DataRowVersion.Original]);                                                                                                    
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Original], "#A38");                                Assert.AreEqual (row [2, DataRowVersion.Original], "#A39", "My LName");                                                                                                    
                                                                                                     
-                                AssertEquals ("#A40", "My FName", row [1, DataRowVersion.Current]);
-                                AssertEquals ("#A41", "My LName", row [2, DataRowVersion.Current]);
+                                Assert.AreEqual ("My FName", row [1, DataRowVersion.Current], "#A40");
+                                Assert.AreEqual ("My LName", row [2, DataRowVersion.Current], "#A41");
                                                                                                     
                                                                                                     
                                 try {
                                       object o = row [1, DataRowVersion.Proposed];
-                                        Fail ("#A42");
+                                        Assert.Fail ("#A42");
                                 }
                                 catch (Exception e) {
                                                 if (e.GetType () != typeof (AssertionException)) {
-                                                        AssertEquals ("#A43", typeof (VersionNotFoundException),
-                                                                e.GetType ());
+                                                        Assert.AreEqual (typeof (VersionNotFoundException), e.GetType (),
+                                                                "#A43");
                                                 }
                                         }
                                                                                                     
@@ -328,22 +329,22 @@ namespace MonoTests.System.Data
                                                                                                     
                         rowC.SetParentRow (table.Rows [0], dr);
                                                                                                     
-                        AssertEquals ("#PRT-01", table.Rows [0], (tableC.Rows [0]).GetParentRow (dr));
-                       AssertEquals ("#PRT-02", tableC.Rows [0], (table.Rows [0]).GetChildRows (dr) [0]);
+                        Assert.AreEqual (table.Rows [0], (tableC.Rows [0]).GetParentRow (dr), "#PRT-01");
+                       Assert.AreEqual (tableC.Rows [0], (table.Rows [0]).GetChildRows (dr) [0], "#PRT-02");
 
                         ds.Relations.Clear ();
                         dr = new DataRelation ("PO", table.Columns ["Id"], tableC.Columns ["Id"], false);
                         ds.Relations.Add (dr);
                         rowC.SetParentRow (table.Rows [0], dr);
-                        AssertEquals ("#PRT-03", table.Rows [0], (tableC.Rows [0]).GetParentRow (dr));
-                       AssertEquals ("#PRT-04", tableC.Rows [0], (table.Rows [0]).GetChildRows (dr) [0]);
+                        Assert.AreEqual (table.Rows [0], (tableC.Rows [0]).GetParentRow (dr), "#PRT-03");
+                       Assert.AreEqual (tableC.Rows [0], (table.Rows [0]).GetChildRows (dr) [0], "#PRT-04");
 
                         ds.Relations.Clear ();
                         dr = new DataRelation ("PO", table.Columns ["Id"], tableC.Columns ["Id"], false);
                         tableC.ParentRelations.Add (dr);
                         rowC.SetParentRow (table.Rows [0]);
-                        AssertEquals ("#PRT-05", table.Rows [0], (tableC.Rows [0]).GetParentRow (dr));
-                        AssertEquals ("#PRT-06", tableC.Rows [0], (table.Rows [0]).GetChildRows (dr) [0]);
+                        Assert.AreEqual (table.Rows [0], (tableC.Rows [0]).GetParentRow (dr), "#PRT-05");
+                        Assert.AreEqual (tableC.Rows [0], (table.Rows [0]).GetChildRows (dr) [0], "#PRT-06");
                                                
                 } 
 
@@ -377,8 +378,8 @@ namespace MonoTests.System.Data
                         rowC.SetParentRow (row, dr);
                         DataRow [] rows = rowC.GetParentRows (dr);
 
-                        AssertEquals ("#A49", 1, rows.Length);
-                        AssertEquals ("#A50", tableP.Rows [0], rows [0]);
+                        Assert.AreEqual (1, rows.Length, "#A49");
+                        Assert.AreEqual (tableP.Rows [0], rows [0], "#A50");
 
                         try{
                                 rows = row.GetParentRows (dr);
@@ -386,10 +387,10 @@ namespace MonoTests.System.Data
                                 //Test done
                                 return ;
                         }catch(Exception e){
-                                Fail("#A51, InvalidConstraintException expected, got : " + e);
+                                Assert.Fail("#A51, InvalidConstraintException expected, got : " + e);
                         }
                         
-                        Fail("#A52, InvalidConstraintException expected but got none.");
+                        Assert.Fail("#A52, InvalidConstraintException expected but got none.");
                 }
 
                 [Test]
@@ -434,8 +435,8 @@ namespace MonoTests.System.Data
                                                                                                     
                         DataRow [] rows = (table.Rows [0]).GetChildRows (dr);
 
-                        AssertEquals ("#A45", 1, rows.Length);
-                        AssertEquals ("#A46", tableC.Rows [0], rows [0]);
+                        Assert.AreEqual (1, rows.Length, "#A45");
+                        Assert.AreEqual (tableC.Rows [0], rows [0], "#A46");
                         
                 } 
 
@@ -469,8 +470,8 @@ namespace MonoTests.System.Data
                         rowC.SetParentRow (row, dr);
                         DataRow [] rows = row.GetChildRows (dr);
                         
-                        AssertEquals ("#A47", 1, rows.Length);
-                        AssertEquals ("#A48", tableC.Rows [0], rows [0]);
+                        Assert.AreEqual (1, rows.Length, "#A47");
+                        Assert.AreEqual (tableC.Rows [0], rows [0], "#A48");
 
                         try{
                             rows = rowC.GetChildRows (dr);
@@ -478,10 +479,10 @@ namespace MonoTests.System.Data
                             //Test done
                             return ;
                         }catch(Exception e){
-                            Fail("#A53, InvalidConstraintException expected, got : " + e);
+                            Assert.Fail("#A53, InvalidConstraintException expected, got : " + e);
                         }
                         
-                        Fail("#A54, InvalidConstraintException expected but got none.");
+                        Assert.Fail("#A54, InvalidConstraintException expected but got none.");
                 }
 
                 [Category ("NotWorking")] //Mismatch in Exception namespace/class reference
@@ -528,35 +529,35 @@ namespace MonoTests.System.Data
                                 //Test Done
                                 return ;
                             }catch (Exception e){
-                                Fail ("#A55, VersionNotFoundException expected, got : " + e);
+                                Assert.Fail ("#A55, VersionNotFoundException expected, got : " + e);
                             }
-                            Fail ("#A56, VersionNotFoundException expected but got none.");
+                            Assert.Fail ("#A56, VersionNotFoundException expected but got none.");
                         }catch (Exception e){
-                            Fail ("#A57, VersionNotFoundException expected, got : " + e);
+                            Assert.Fail ("#A57, VersionNotFoundException expected, got : " + e);
                         }
                         
-                        Fail("#A58, VersionNotFoundException expected but got none.");
+                        Assert.Fail("#A58, VersionNotFoundException expected but got none.");
                 }
 
                // tests item at row, column in table to be DBNull.Value
                private void DBNullTest (string message, DataTable dt, int row, int column) 
                {
                        object val = dt.Rows[row].ItemArray[column];
-                       AssertEquals(message, DBNull.Value, val);
+                       Assert.AreEqual(DBNull.Value, val, message);
                }
 
                // tests item at row, column in table to be null
                private void NullTest (string message, DataTable dt, int row, int column) 
                {
                        object val = dt.Rows[row].ItemArray[column];
-                       AssertEquals(message, null, val);
+                       Assert.AreEqual(null, val, message);
                }
 
                // tests item at row, column in table to be 
                private void ValueTest (string message, DataTable dt, int row, int column, object value) 
                {
                        object val = dt.Rows[row].ItemArray[column];
-                       AssertEquals(message, value, val);
+                       Assert.AreEqual(value, val, message);
                }
 
                // test set null, DBNull.Value, and ItemArray short count
@@ -588,7 +589,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e1) {
-                               Fail("DR1: Exception Caught: " + e1);
+                               Assert.Fail("DR1: Exception Caught: " + e1);
                        }
                        
                        table.Rows.Add(row);
@@ -606,7 +607,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e2) {
-                               Fail("DR2: Exception Caught: " + e2);
+                               Assert.Fail("DR2: Exception Caught: " + e2);
                        }
                        
                        table.Rows.Add(row);
@@ -624,7 +625,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e3) {
-                               Fail("DR3: Exception Caught: " + e3);
+                               Assert.Fail("DR3: Exception Caught: " + e3);
                        }
                        
                        table.Rows.Add(row);
@@ -646,7 +647,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e3) {
-                               Fail("DR4: Exception Caught: " + e3);
+                               Assert.Fail("DR4: Exception Caught: " + e3);
                        }
                        
                        table.Rows.Add(row);
@@ -698,7 +699,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e1) {
-                               Fail("DR17: Exception Caught: " + e1);
+                               Assert.Fail("DR17: Exception Caught: " + e1);
                        }
                        
                        table.Rows.Add(row);
@@ -715,7 +716,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e2) {
-                               Fail("DR18: Exception Caught: " + e2);
+                               Assert.Fail("DR18: Exception Caught: " + e2);
                        }
                        
                        table.Rows.Add(row);
@@ -733,7 +734,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e3) {
-                               Fail("DR19: Exception Caught: " + e3);
+                               Assert.Fail("DR19: Exception Caught: " + e3);
                        }
                        
                        table.Rows.Add(row);
@@ -753,7 +754,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e3) {
-                               Fail("DR20: Exception Caught: " + e3);
+                               Assert.Fail("DR20: Exception Caught: " + e3);
                        }
                        
                        table.Rows.Add(row);
@@ -802,7 +803,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e1) {
-                               Fail("DR28:  Exception Caught: " + e1);
+                               Assert.Fail("DR28:  Exception Caught: " + e1);
                        }
                        
                        table.Rows.Add(row);
@@ -819,7 +820,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e2) {
-                               Fail("DR29:  Exception Caught: " + e2);
+                               Assert.Fail("DR29:  Exception Caught: " + e2);
                        }
                        
                        table.Rows.Add(row);
@@ -836,7 +837,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e2) {
-                               Fail("DR30: Exception Caught: " + e2);
+                               Assert.Fail("DR30: Exception Caught: " + e2);
                        }
                        
                        table.Rows.Add(row);
@@ -853,7 +854,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e2) {
-                               Fail("DR31: Exception Caught: " + e2);
+                               Assert.Fail("DR31: Exception Caught: " + e2);
                        }
                        
                        table.Rows.Add(row);
@@ -872,7 +873,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e3) {
-                               Fail("DR32: Exception Caught: " + e3);
+                               Assert.Fail("DR32: Exception Caught: " + e3);
                        }
                        
                        table.Rows.Add(row);
@@ -889,7 +890,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e2) {
-                               Fail("DR48: Exception Caught: " + e2);
+                               Assert.Fail("DR48: Exception Caught: " + e2);
                        }
                        
                        table.Rows.Add(row);
@@ -909,7 +910,7 @@ namespace MonoTests.System.Data
                                row.ItemArray = obj;
                        }
                        catch(Exception e3) {
-                               Fail("DR33: Exception Caught: " + e3);
+                               Assert.Fail("DR33: Exception Caught: " + e3);
                        }
                        
                        table.Rows.Add(row);
@@ -986,7 +987,7 @@ namespace MonoTests.System.Data
                        DataRow childRow = child.Rows.Add(new object[] { id });
                        if (parentRow == childRow.GetParentRow(relateParentChild)) {
                            foreach(DataColumn dc in parent.Columns)
-                               AssertEquals(100,parentRow[dc]);
+                               Assert.AreEqual(100,parentRow[dc]);
                            
                        }
                                        
@@ -1002,9 +1003,9 @@ namespace MonoTests.System.Data
                        dt.Rows.Add ((new object [] {"val"}));
 
                        DataRow dr = dt.NewRow ();
-                       AssertEquals (DataRowState.Detached, dr.RowState);
+                       Assert.AreEqual (DataRowState.Detached, dr.RowState);
                        dr.CancelEdit ();
-                       AssertEquals (DataRowState.Detached, dr.RowState);
+                       Assert.AreEqual (DataRowState.Detached, dr.RowState);
                        object o = dr ["col"];
                }
 
@@ -1056,20 +1057,20 @@ namespace MonoTests.System.Data
                        parent2.Rows.Add(parent2Row);
 
                        childRow1.SetParentRow(parent1Row);
-                       AssertEquals ("p1c1", childRow1[childColumn1]);
-                       AssertEquals (DBNull.Value, childRow1[childColumn2]);
+                       Assert.AreEqual ("p1c1", childRow1[childColumn1]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn2]);
 
                        childRow1.SetParentRow(parent2Row);
-                       AssertEquals ("p1c1", childRow1[childColumn1]);
-                       AssertEquals ("p2c2", childRow1[childColumn2]);
+                       Assert.AreEqual ("p1c1", childRow1[childColumn1]);
+                       Assert.AreEqual ("p2c2", childRow1[childColumn2]);
 
                        childRow1.SetParentRow(null);
-                       AssertEquals (DBNull.Value, childRow1[childColumn1]);
-                       AssertEquals (DBNull.Value, childRow1[childColumn2]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn1]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn2]);
 
                        childRow1.SetParentRow(parent2Row);
-                       AssertEquals (DBNull.Value, childRow1[childColumn1]);
-                       AssertEquals ("p2c2", childRow1[childColumn2]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn1]);
+                       Assert.AreEqual ("p2c2", childRow1[childColumn2]);
                }
 
                [Test]
@@ -1108,29 +1109,29 @@ namespace MonoTests.System.Data
 
 
                        childRow1.SetParentRow (null, relation2);
-                       AssertEquals (DBNull.Value, childRow1[childColumn1]);
-                       AssertEquals (DBNull.Value, childRow1[childColumn2]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn1]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn2]);
 
                        try {
                                childRow1.SetParentRow(parent1Row, relation2);
-                               Fail ("Must throw InvalidConstaintException");
+                               Assert.Fail ("Must throw InvalidConstaintException");
                        } catch (InvalidConstraintException e) {
                        }
-                       AssertEquals (DBNull.Value, childRow1[childColumn1]);
-                       AssertEquals (DBNull.Value, childRow1[childColumn2]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn1]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn2]);
 
                        childRow1.SetParentRow(parent1Row, relation1);
-                       AssertEquals ("p1c1", childRow1[childColumn1]);
-                       AssertEquals (DBNull.Value, childRow1[childColumn2]);
+                       Assert.AreEqual ("p1c1", childRow1[childColumn1]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn2]);
 
 
                        childRow1.SetParentRow (null, relation2);
-                       AssertEquals ("p1c1", childRow1[childColumn1]);
-                       AssertEquals (DBNull.Value, childRow1[childColumn2]);
+                       Assert.AreEqual ("p1c1", childRow1[childColumn1]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn2]);
 
                        childRow1.SetParentRow (null, relation1);
-                       AssertEquals (DBNull.Value, childRow1[childColumn1]);
-                       AssertEquals (DBNull.Value, childRow1[childColumn2]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn1]);
+                       Assert.AreEqual (DBNull.Value, childRow1[childColumn2]);
                }
 
                [Test]
@@ -1161,8 +1162,8 @@ namespace MonoTests.System.Data
                        parent2.Rows.Add(parentRow);
 
                        childRow.SetParentRow(parentRow);
-                       AssertEquals (DBNull.Value, childRow[childColumn1]);
-                       AssertEquals ("value", childRow[childColumn2]);
+                       Assert.AreEqual (DBNull.Value, childRow[childColumn1]);
+                       Assert.AreEqual ("value", childRow[childColumn2]);
                }
 
        }
index 51885f37bcb0a2cc4f5e2cd883495bc9b3166c38..60dbb9d39339dc98b2a526703428273d5b7a10e9 100644 (file)
@@ -36,7 +36,7 @@ using System.ComponentModel;
 namespace MonoTests.System.Data
 {
        [TestFixture]
-       public class DataRowViewTest : Assertion
+       public class DataRowViewTest 
        {
                private DataView CreateTestView ()
                {
@@ -96,8 +96,8 @@ namespace MonoTests.System.Data
                        DataView dv = new DataView (dt1);
                        DataRowView dvr = dv [0];
                        DataView v = dvr.CreateChildView (dr);
-                       AssertEquals ("RowFilter", "", v.RowFilter);
-                       AssertEquals ("Sort", "", v.Sort);
+                       Assert.AreEqual ("", v.RowFilter, "RowFilter");
+                       Assert.AreEqual ("", v.Sort, "Sort");
                }
 
                [Test]
@@ -110,12 +110,12 @@ namespace MonoTests.System.Data
                        DataView dv = new DataView (dt);
                        DataRowView drv = dv [0];
                        dt.Rows [0].BeginEdit ();
-                       AssertEquals ("DataView.Item", true, drv.IsEdit);
+                       Assert.AreEqual (true, drv.IsEdit, "DataView.Item");
 
                        drv = dv.AddNew ();
                        drv.Row ["col"] = "test";
                        drv.Row.CancelEdit ();
-                       AssertEquals ("AddNew", false, drv.IsEdit);
+                       Assert.AreEqual (false, drv.IsEdit, "AddNew");
                }
 
                [Test]
@@ -127,7 +127,7 @@ namespace MonoTests.System.Data
                        DataView dv = new DataView (dt);
                        DataRowView drv = dv [0];
                        dt.Rows [0].BeginEdit ();
-                       AssertEquals ("DataView.Item", "val", drv ["col"]);
+                       Assert.AreEqual ("val", drv ["col"], "DataView.Item");
                }
 
                [Test]
@@ -153,18 +153,18 @@ namespace MonoTests.System.Data
                        dt.Rows.Add (new object [] {1});
                        DataView dv = new DataView (dt);
                        DataRowView drv = dv.AddNew ();
-                       AssertEquals (DataRowVersion.Current, drv.RowVersion);
-                       AssertEquals (DataRowVersion.Current, dv [0].RowVersion);
+                       Assert.AreEqual (DataRowVersion.Current, drv.RowVersion);
+                       Assert.AreEqual (DataRowVersion.Current, dv [0].RowVersion);
                        drv ["col"] = "mod";
-                       AssertEquals (DataRowVersion.Current, drv.RowVersion);
-                       AssertEquals (DataRowVersion.Current, dv [0].RowVersion);
+                       Assert.AreEqual (DataRowVersion.Current, drv.RowVersion);
+                       Assert.AreEqual (DataRowVersion.Current, dv [0].RowVersion);
                        dt.AcceptChanges ();
-                       AssertEquals (DataRowVersion.Current, drv.RowVersion);
-                       AssertEquals (DataRowVersion.Current, dv [0].RowVersion);
+                       Assert.AreEqual (DataRowVersion.Current, drv.RowVersion);
+                       Assert.AreEqual (DataRowVersion.Current, dv [0].RowVersion);
                        drv.EndEdit ();
                        dv [0].EndEdit ();
-                       AssertEquals (DataRowVersion.Current, drv.RowVersion);
-                       AssertEquals (DataRowVersion.Current, dv [0].RowVersion);
+                       Assert.AreEqual (DataRowVersion.Current, drv.RowVersion);
+                       Assert.AreEqual (DataRowVersion.Current, dv [0].RowVersion);
                }
        }
 }
index 05d0eddc7fba37c4b61b41c75063272fec799956..bf34b01d1c61a9fe7921050a5e0f168b7e3430ba 100644 (file)
@@ -37,7 +37,7 @@ namespace MonoTests.System.Data
 {
 
        [TestFixture]
-       public class DataTableCollectionTest : Assertion {
+       public class DataTableCollectionTest {
                // common variables here
                private DataSet [] _dataset;
                private DataTable [] _tables;
@@ -76,11 +76,11 @@ namespace MonoTests.System.Data
                        
                        foreach( DataTable table in tbcol )
                        {
-                               AssertEquals("test#1",_tables[i].TableName,table.TableName);
+                               Assert.AreEqual(_tables[i].TableName,table.TableName,"test#1");
                                j=0;
                                foreach( DataColumn column in table.Columns )
                                {
-                                       AssertEquals("test#2",_tables[i].Columns[j].ColumnName,column.ColumnName);
+                                       Assert.AreEqual(_tables[i].Columns[j].ColumnName,column.ColumnName,"test#2");
                                        j++;
                                }
                                i++;
@@ -90,11 +90,11 @@ namespace MonoTests.System.Data
                        i=0;
                        foreach( DataTable table in tbcol )
                        {
-                               AssertEquals("test#3",_tables[i].TableName,table.TableName);
+                               Assert.AreEqual(_tables[i].TableName,table.TableName,"test#3");
                                j=0;
                                foreach( DataColumn column in table.Columns )
                                {
-                                       AssertEquals("test#4",_tables[i].Columns[j].ColumnName,column.ColumnName);
+                                       Assert.AreEqual(_tables[i].Columns[j].ColumnName,column.ColumnName,"test#4");
                                        j++;
                                }
                                i++;
@@ -143,9 +143,9 @@ namespace MonoTests.System.Data
                {
                        DataTableCollection tbcol = _dataset[0].Tables;
                        tbcol.Add(_tables[0]);
-                       AssertEquals("test#1",1, tbcol.Count);
+                       Assert.AreEqual(1,tbcol.Count, "test#1");
                        tbcol.Add(_tables[1]);
-                       AssertEquals("test#2",2, tbcol.Count);
+                       Assert.AreEqual(2,tbcol.Count, "test#2");
                }
                
                [Test]
@@ -159,11 +159,11 @@ namespace MonoTests.System.Data
                        i=0;
                        foreach( DataTable table in tbcol )
                        {
-                               AssertEquals("test#1",_tables[i].TableName,table.TableName);
+                               Assert.AreEqual(_tables[i].TableName,table.TableName,"test#1");
                                j=0;
                                foreach( DataColumn column in table.Columns )
                                {
-                                       AssertEquals("test#2",_tables[i].Columns[j].ColumnName,column.ColumnName);
+                                       Assert.AreEqual(_tables[i].Columns[j].ColumnName,column.ColumnName,"test#2");
                                        j++;
                                }
                                i++;
@@ -179,11 +179,11 @@ namespace MonoTests.System.Data
                        tbcol.AddRange(_tables);
                        DataTable tbl = null;
                        /* checking for a recently input table, expecting true */
-                       AssertEquals("test#1",true,tbcol.CanRemove(_tables[0]));
+                       Assert.AreEqual(true,tbcol.CanRemove(_tables[0]),"test#1");
                        /* trying to check with a null reference, expecting false */
-                       AssertEquals("test#2",false,tbcol.CanRemove(tbl));
+                       Assert.AreEqual(false,tbcol.CanRemove(tbl),"test#2");
                        /* trying to check with a table that does not exist in collection, expecting false */
-                       AssertEquals("test#3",false,tbcol.CanRemove(new DataTable("newTable")));
+                       Assert.AreEqual(false,tbcol.CanRemove(new DataTable("newTable")),"test#3");
                }
                
                [Test]
@@ -197,27 +197,27 @@ namespace MonoTests.System.Data
                        /* removing a recently added table */
                        int count = tbcol.Count;
                        tbcol.Remove(_tables[0]);
-                       AssertEquals("test#1",count-1,tbcol.Count);
+                       Assert.AreEqual(count-1,tbcol.Count,"test#1");
                        DataTable tbl = null;
                        /* removing a null reference. must generate an Exception */
                        try
                        {
                                tbcol.Remove(tbl);
-                               Fail("Err:: tbcol.Rmove(null) must fail");
+                               Assert.Fail("Err:: tbcol.Rmove(null) must fail");
                        }
                        catch(Exception e)
                        {
-                               AssertEquals ("test#2", typeof (ArgumentNullException), e.GetType());
+                               Assert.AreEqual (typeof (ArgumentNullException), e.GetType(), "test#2");
                        }
                        /* removing a table that is not there in collection */
                        try
                        {
                                tbcol.Remove(new DataTable("newTable"));
-                               Fail("Err:: cannot remove a table that is not there in collection");
+                               Assert.Fail("Err:: cannot remove a table that is not there in collection");
                        }
                        catch(Exception e)
                        {
-                               AssertEquals ("test#3", typeof (ArgumentException), e.GetType());
+                               Assert.AreEqual (typeof (ArgumentException), e.GetType(), "test#3");
                        }
                        
                }
@@ -227,11 +227,11 @@ namespace MonoTests.System.Data
                        DataTableCollection tbcol = _dataset[0].Tables;
                        tbcol.Add(_tables[0]);
                        tbcol.Clear();
-                       AssertEquals("Test#1",0,tbcol.Count);
+                       Assert.AreEqual(0,tbcol.Count,"Test#1");
                        
                        tbcol.AddRange(new DataTable[] {_tables[0],_tables[1]});
                        tbcol.Clear();
-                       AssertEquals("Test#2",0,tbcol.Count);
+                       Assert.AreEqual(0,tbcol.Count,"Test#2");
                }
                [Test]
                public void Contains()
@@ -242,11 +242,11 @@ namespace MonoTests.System.Data
                        tbcol.AddRange(_tables);
                        string tblname = "";
                        /* checking for a recently input table, expecting true */
-                       AssertEquals("test#1",true,tbcol.Contains(_tables[0].TableName));
+                       Assert.AreEqual(true,tbcol.Contains(_tables[0].TableName),"test#1");
                        /* trying to check with a empty string, expecting false */
-                       AssertEquals("test#2",false,tbcol.Contains(tblname));
+                       Assert.AreEqual(false,tbcol.Contains(tblname),"test#2");
                        /* trying to check for a table that donot exist, expecting false */
-                       AssertEquals("test#3",false,tbcol.Contains("InvalidTableName"));
+                       Assert.AreEqual(false,tbcol.Contains("InvalidTableName"),"test#3");
                }
                
                [Test]
@@ -261,21 +261,21 @@ namespace MonoTests.System.Data
                        DataTable [] array = new DataTable[4];
                        /* copying to the beginning of the array */
                        tbcol.CopyTo(array,0);
-                       AssertEquals ("test#01", 4, array.Length);
-                       AssertEquals ("test#02", "Table1", array[0].TableName);
-                       AssertEquals ("test#03", "Table2", array[1].TableName);
-                       AssertEquals ("test#04", "Table3", array[2].TableName);
-                       AssertEquals ("test#05", "Table4", array[3].TableName);
+                       Assert.AreEqual (4, array.Length, "test#01");
+                       Assert.AreEqual ("Table1", array[0].TableName, "test#02");
+                       Assert.AreEqual ("Table2", array[1].TableName, "test#03");
+                       Assert.AreEqual ("Table3", array[2].TableName, "test#04");
+                       Assert.AreEqual ("Table4", array[3].TableName, "test#05");
 
                        /* copying with in a array */
                        DataTable [] array1 = new DataTable[6];
                        tbcol.CopyTo(array1,2);
-                       AssertEquals("test#06",null,array1[0]);
-                       AssertEquals("test#07",null,array1[1]);
-                       AssertEquals("test#08","Table1",array1[2].TableName);
-                       AssertEquals("test#09","Table2",array1[3].TableName);
-                       AssertEquals("test#10","Table3",array1[4].TableName);
-                       AssertEquals("test#11","Table4",array1[5].TableName);                   
+                       Assert.AreEqual(null,array1[0],"test#06");
+                       Assert.AreEqual(null,array1[1],"test#07");
+                       Assert.AreEqual("Table1",array1[2].TableName,"test#08");
+                       Assert.AreEqual("Table2",array1[3].TableName,"test#09");
+                       Assert.AreEqual("Table3",array1[4].TableName,"test#10");
+                       Assert.AreEqual("Table4",array1[5].TableName,"test#11");                        
                }
                [Test]
                public void Equals()
@@ -287,16 +287,16 @@ namespace MonoTests.System.Data
                        tbcol2.Add(_tables[1]);
                        tbcol3 = tbcol1;
                        
-                       AssertEquals("test#1",true,tbcol1.Equals(tbcol1));
-                       AssertEquals("test#2",true,tbcol1.Equals(tbcol3));
-                       AssertEquals("test#3",true,tbcol3.Equals(tbcol1));
+                       Assert.AreEqual(true,tbcol1.Equals(tbcol1),"test#1");
+                       Assert.AreEqual(true,tbcol1.Equals(tbcol3),"test#2");
+                       Assert.AreEqual(true,tbcol3.Equals(tbcol1),"test#3");
                        
-                       AssertEquals("test#4",false,tbcol1.Equals(tbcol2));
-                       AssertEquals("test#5",false,tbcol2.Equals(tbcol1));
+                       Assert.AreEqual(false,tbcol1.Equals(tbcol2),"test#4");
+                       Assert.AreEqual(false,tbcol2.Equals(tbcol1),"test#5");
                        
-                       AssertEquals("test#6",true,Object.Equals(tbcol1,tbcol3));
-                       AssertEquals("test#7",true,Object.Equals(tbcol1,tbcol1));
-                       AssertEquals("test#8",false,Object.Equals(tbcol1,tbcol2));
+                       Assert.AreEqual(true,Object.Equals(tbcol1,tbcol3),"test#6");
+                       Assert.AreEqual(true,Object.Equals(tbcol1,tbcol1),"test#7");
+                       Assert.AreEqual(false,Object.Equals(tbcol1,tbcol2),"test#8");
                }
                [Test]
                public void IndexOf()
@@ -306,16 +306,16 @@ namespace MonoTests.System.Data
                        tbcol.Add("table1");
                        tbcol.Add("table2");
                        
-                       AssertEquals("test#1",0,tbcol.IndexOf(_tables[0]));
-                       AssertEquals("test#2",-1,tbcol.IndexOf(_tables[1]));
-                       AssertEquals("test#3",1,tbcol.IndexOf("table1"));
-                       AssertEquals("test#4",2,tbcol.IndexOf("table2"));
+                       Assert.AreEqual(0,tbcol.IndexOf(_tables[0]),"test#1");
+                       Assert.AreEqual(-1,tbcol.IndexOf(_tables[1]),"test#2");
+                       Assert.AreEqual(1,tbcol.IndexOf("table1"),"test#3");
+                       Assert.AreEqual(2,tbcol.IndexOf("table2"),"test#4");
                        
-                       AssertEquals("test#5",0,tbcol.IndexOf(tbcol[0]));
-                       AssertEquals("test#6",1,tbcol.IndexOf(tbcol[1]));
-                       AssertEquals("test#7",-1,tbcol.IndexOf("_noTable_"));
+                       Assert.AreEqual(0,tbcol.IndexOf(tbcol[0]),"test#5");
+                       Assert.AreEqual(1,tbcol.IndexOf(tbcol[1]),"test#6");
+                       Assert.AreEqual(-1,tbcol.IndexOf("_noTable_"),"test#7");
                        DataTable tb = new DataTable("new_table");
-                       AssertEquals("test#8",-1,tbcol.IndexOf(tb));
+                       Assert.AreEqual(-1,tbcol.IndexOf(tb),"test#8");
                        
                }
                [Test]
@@ -328,7 +328,7 @@ namespace MonoTests.System.Data
                        try
                        {
                                tbcol.RemoveAt(-1);
-                               Fail("the index was out of bound: must have failed");
+                               Assert.Fail("the index was out of bound: must have failed");
                        }
                        catch(IndexOutOfRangeException e)
                        {
@@ -336,15 +336,15 @@ namespace MonoTests.System.Data
                        try
                        {
                                tbcol.RemoveAt(101);
-                               Fail("the index was out of bound: must have failed");
+                               Assert.Fail("the index was out of bound: must have failed");
                        }
                        catch(IndexOutOfRangeException e)
                        {
                        }
                        tbcol.RemoveAt (1);
-                       AssertEquals ("test#5", 1, tbcol.Count);
+                       Assert.AreEqual (1, tbcol.Count, "test#5");
                        tbcol.RemoveAt (0);
-                       AssertEquals ("test#6", 0, tbcol.Count);
+                       Assert.AreEqual (0, tbcol.Count, "test#6");
                }
 
                [Test]
@@ -354,46 +354,46 @@ namespace MonoTests.System.Data
                        tbcol.Add("Table1");
                        tbcol.Add("Table2");
                        tbcol.Add("Table3");
-                       AssertEquals("test#1","System.Data.DataTableCollection",tbcol.ToString());
+                       Assert.AreEqual("System.Data.DataTableCollection",tbcol.ToString(),"test#1");
                }
 
                [Test]
                public void TableDataSetNamespaces ()
                {
                        DataTable dt = new DataTable ("dt1");
-                       AssertEquals ("#1-1", String.Empty, dt.Namespace);
-                       AssertNull ("#1-2", dt.DataSet);
+                       Assert.AreEqual (String.Empty, dt.Namespace, "#1-1");
+                       Assert.IsNull (dt.DataSet, "#1-2");
 
                        DataSet ds1 = new DataSet ("ds1");
                        ds1.Tables.Add (dt);
-                       AssertEquals ("#2-1", String.Empty, dt.Namespace);
-                       AssertEquals ("#2-2", ds1, dt.DataSet);
+                       Assert.AreEqual (String.Empty, dt.Namespace, "#2-1");
+                       Assert.AreEqual (ds1, dt.DataSet, "#2-2");
 
                        ds1.Namespace = "ns1";
-                       AssertEquals ("#3", "ns1", dt.Namespace);
+                       Assert.AreEqual ("ns1", dt.Namespace, "#3");
 
                        // back to null again
                        ds1.Tables.Remove (dt);
-                       AssertEquals ("#4-1", String.Empty, dt.Namespace);
-                       AssertNull ("#4-2", dt.DataSet);
+                       Assert.AreEqual (String.Empty, dt.Namespace, "#4-1");
+                       Assert.IsNull (dt.DataSet, "#4-2");
 
                        // This table is being added to _already namespaced_
                        // dataset.
                        dt = new DataTable ("dt2");
 
                        ds1.Tables.Add (dt);
-                       AssertEquals ("#5-1", "ns1", dt.Namespace);
-                       AssertEquals ("#5-2", ds1, dt.DataSet);
+                       Assert.AreEqual ("ns1", dt.Namespace, "#5-1");
+                       Assert.AreEqual (ds1, dt.DataSet, "#5-2");
 
                        ds1.Tables.Remove (dt);
-                       AssertEquals ("#6-1", String.Empty, dt.Namespace);
-                       AssertNull ("#6-2", dt.DataSet);
+                       Assert.AreEqual (String.Empty, dt.Namespace, "#6-1");
+                       Assert.IsNull (dt.DataSet, "#6-2");
 
                        DataSet ds2 = new DataSet ("ds2");
                        ds2.Namespace = "ns2";
                        ds2.Tables.Add (dt);
-                       AssertEquals ("#7-1", "ns2", dt.Namespace);
-                       AssertEquals ("#7-2", ds2, dt.DataSet);
+                       Assert.AreEqual ("ns2", dt.Namespace, "#7-1");
+                       Assert.AreEqual (ds2, dt.DataSet, "#7-2");
                }
        }
 }
index 57b5eb30846c9f6fddbfbce275d26caa6ad3bf71..392f9b0d4f4e28b48cfa26448425de1e06edbe34 100644 (file)
@@ -36,7 +36,7 @@ using System.ComponentModel;
 namespace MonoTests.System.Data
 {
        [TestFixture]
-       public class DataViewManagerTest : Assertion
+       public class DataViewManagerTest 
        {
                [Test]
                public void Ctor ()
@@ -46,40 +46,40 @@ namespace MonoTests.System.Data
                        string deleted = @"<DataViewSettingCollectionString><table2-1 Sort="""" RowFilter="""" RowStateFilter=""Deleted""/></DataViewSettingCollectionString>";
 
                        DataViewManager m = new DataViewManager (null);
-                       AssertNull (m.DataSet);
-                       AssertEquals ("", m.DataViewSettingCollectionString);
-                       AssertNotNull (m.DataViewSettings);
+                       Assert.IsNull (m.DataSet);
+                       Assert.AreEqual ("", m.DataViewSettingCollectionString);
+                       Assert.IsNotNull (m.DataViewSettings);
                        DataSet ds = new DataSet ("ds");
                        m.DataSet = ds;
-                       AssertEquals ("default#1", defaultString,
-                               m.DataViewSettingCollectionString);
+                       Assert.AreEqual (defaultString, m.DataViewSettingCollectionString,
+                               "default#1");
 
                        DataSet ds2 = new DataSet ("ds2");
-                       AssertEquals ("default#2", defaultString,
-                               ds.DefaultViewManager.DataViewSettingCollectionString);
+                       Assert.AreEqual (defaultString, ds.DefaultViewManager.DataViewSettingCollectionString,
+                               "default#2");
                        DataTable dt2_1 = new DataTable ("table2-1");
                        dt2_1.Namespace ="urn:foo"; // It is ignored though.
                        ds2.Tables.Add (dt2_1);
                        m.DataSet = ds2;
-                       AssertEquals ("#3", current, m.DataViewSettingCollectionString);
+                       Assert.AreEqual (current, m.DataViewSettingCollectionString, "#3");
 
                        // Note that " Deleted " is trimmed.
                        m.DataViewSettingCollectionString = @"<DataViewSettingCollectionString><table2-1 Sort='' RowFilter='' RowStateFilter=' Deleted '/></DataViewSettingCollectionString>";
-                       AssertEquals ("#4", deleted, m.DataViewSettingCollectionString);
+                       Assert.AreEqual (deleted, m.DataViewSettingCollectionString, "#4");
 
                        m.DataSet = ds2; //resets modified string.
-                       AssertEquals ("#5", current, m.DataViewSettingCollectionString);
+                       Assert.AreEqual (current, m.DataViewSettingCollectionString, "#5");
 
                        m.DataViewSettingCollectionString = @"<DataViewSettingCollectionString><table2-1 Sort='' RowFilter='' RowStateFilter='Deleted'/></DataViewSettingCollectionString>";
                        // it does not clear anything.
                        m.DataViewSettingCollectionString = "<DataViewSettingCollectionString/>";
-                       AssertEquals ("#6", deleted, m.DataViewSettingCollectionString);
+                       Assert.AreEqual (deleted, m.DataViewSettingCollectionString, "#6");
 
                        // text node is not rejected (ignored).
                        // RowFilter is not examined.
                        m.DataViewSettingCollectionString = "<DataViewSettingCollectionString>blah<table2-1 RowFilter='a=b' ApplyDefaultSort='true' /></DataViewSettingCollectionString>";
                        // LAMESPEC: MS.NET ignores ApplyDefaultSort.
-//                     AssertEquals ("#7", @"<DataViewSettingCollectionString><table2-1 Sort="""" RowFilter=""a=b"" RowStateFilter=""Deleted""/></DataViewSettingCollectionString>", m.DataViewSettingCollectionString);
+//                     Assert.AreEqual (@"<DataViewSettingCollectionString><table2-1 Sort="""" RowFilter=""a=b"" RowStateFilter=""Deleted""/></DataViewSettingCollectionString>", m.DataViewSettingCollectionString, "#7");
                }
 
                [Test]
index 4be1824f6674c064bd460a4a3f0cab070727b250..8829819a4503b3337adf66c5a9ac6d08436f5ca3 100644 (file)
@@ -42,7 +42,7 @@ using System.IO;
 namespace MonoTests.System.Data
 {
        [TestFixture]
-       public class DataViewTest : Assertion
+       public class DataViewTest
        {
                DataTable dataTable;
                DataView  dataView;
@@ -145,7 +145,7 @@ namespace MonoTests.System.Data
                        dv.Sort = "abc";
                        dv.Sort = string.Empty;
                        dv.Sort = "abc";
-                       AssertEquals ("test#01", "abc", dv.Sort);
+                       Assert.AreEqual ("abc", dv.Sort, "test#01");
                }
 
                [Test]
@@ -154,24 +154,24 @@ namespace MonoTests.System.Data
                        DataView dv1,dv2,dv3;
                        dv1 = new DataView ();
                        // AssertEquals ("test#01",null,dv1.Table);
-                       AssertEquals ("test#02",true,dv1.AllowNew);
-                       AssertEquals ("test#03",true,dv1.AllowEdit);
-                       AssertEquals ("test#04",true,dv1.AllowDelete);
-                       AssertEquals ("test#05",false,dv1.ApplyDefaultSort);
-                       AssertEquals ("test#06",string.Empty,dv1.RowFilter);
-                       AssertEquals ("test#07",DataViewRowState.CurrentRows,dv1.RowStateFilter);
-                       AssertEquals ("test#08",string.Empty,dv1.Sort);
+                       Assert.AreEqual (true,dv1.AllowNew,"test#02");;
+                       Assert.AreEqual (true,dv1.AllowEdit,"test#03");;
+                       Assert.AreEqual (true,dv1.AllowDelete,"test#04");;
+                       Assert.AreEqual (false,dv1.ApplyDefaultSort,"test#05");;
+                       Assert.AreEqual (string.Empty,dv1.RowFilter,"test#06");;
+                       Assert.AreEqual (DataViewRowState.CurrentRows,dv1.RowStateFilter,"test#07");;
+                       Assert.AreEqual (string.Empty,dv1.Sort,"test#08");;
                        
                        dv2 = new DataView (dataTable);
-                       AssertEquals ("test#09","itemTable",dv2.Table.TableName);
-                       AssertEquals ("test#10",string.Empty,dv2.Sort);
-                       AssertEquals ("test#11",false,dv2.ApplyDefaultSort);
-                       AssertEquals ("test#12",dataTable.Rows[0],dv2[0].Row);
+                       Assert.AreEqual ("itemTable",dv2.Table.TableName,"test#09");;
+                       Assert.AreEqual (string.Empty,dv2.Sort,"test#10");;
+                       Assert.AreEqual (false,dv2.ApplyDefaultSort,"test#11");;
+                       Assert.AreEqual (dataTable.Rows[0],dv2[0].Row,"test#12");;
                        
                        dv3 = new DataView (dataTable,"","itemId DESC",DataViewRowState.CurrentRows);
-                       AssertEquals ("test#13","",dv3.RowFilter);
-                       AssertEquals ("test#14","itemId DESC",dv3.Sort);
-                       AssertEquals ("test#15",DataViewRowState.CurrentRows,dv3.RowStateFilter);
+                       Assert.AreEqual ("",dv3.RowFilter,"test#13");;
+                       Assert.AreEqual ("itemId DESC",dv3.Sort,"test#14");;
+                       Assert.AreEqual (DataViewRowState.CurrentRows,dv3.RowStateFilter,"test#15");;
                        //AssertEquals ("test#16",dataTable.Rows.[(dataTable.Rows.Count-1)],dv3[0]);
                }
 
@@ -179,20 +179,20 @@ namespace MonoTests.System.Data
                 public void TestValue ()
                 {
                        DataView TestView = new DataView (dataTable);
-                       Assertion.AssertEquals ("Dv #1", "item 1", TestView [0]["itemId"]);
+                       Assert.AreEqual ("item 1", TestView [0]["itemId"], "Dv #1");
                 }
 
                 [Test]
                 public void TestCount ()
                 {
                        DataView TestView = new DataView (dataTable);
-                       Assertion.AssertEquals ("Dv #3", 5, TestView.Count);
+                       Assert.AreEqual (5, TestView.Count, "Dv #3");
                 }
 
                [Test]
                public void AllowNew ()
                {
-                       AssertEquals ("test#01",true,dataView.AllowNew);
+                       Assert.AreEqual (true, dataView.AllowNew, "test#01");
                }
 
                [Test]
@@ -203,7 +203,7 @@ namespace MonoTests.System.Data
                        dataView.ApplyDefaultSort = true;
                        // dataView.Sort = "itemName";
                        // AssertEquals ("test#01","item 1",dataView[0]["itemId"]);
-                       AssertEquals ("test#02",ListChangedType.Reset,listChangedArgs.ListChangedType);
+                       Assert.AreEqual (ListChangedType.Reset,listChangedArgs.ListChangedType, "test#02");
                        // UnComment the line below to see if dataView is sorted
                        //   PrintTableOrView (dataView,"* OnApplyDefaultSort");
                }
@@ -212,7 +212,7 @@ namespace MonoTests.System.Data
                public void RowStateFilter ()
                {
                        dataView.RowStateFilter = DataViewRowState.Deleted;
-                       AssertEquals ("test#01",ListChangedType.Reset,listChangedArgs.ListChangedType);
+                       Assert.AreEqual (ListChangedType.Reset,listChangedArgs.ListChangedType, "test#01");
                }
 
                [Test]
@@ -239,16 +239,16 @@ namespace MonoTests.System.Data
                        dataView [0] ["col1"] = -1;
                        dataView.RowStateFilter = DataViewRowState.ModifiedOriginal;
                        v = dataView [0] [0].ToString ();
-                       AssertEquals ("ModifiedOriginal.Count", 1, dataView.Count);
-                       AssertEquals ("ModifiedOriginal.Value", "1", v);
+                       Assert.AreEqual (1, dataView.Count, "ModifiedOriginal.Count");
+                       Assert.AreEqual ("1", v, "ModifiedOriginal.Value");
 
                        // Deleting the row
                        dataView.Delete (0);
                        dataView.RowStateFilter = DataViewRowState.Deleted;
 
                        v = dataView [0] [0].ToString ();
-                       AssertEquals ("Deleted.Count", 1, dataView.Count);
-                       AssertEquals ("Deleted.Value", "1", v);
+                       Assert.AreEqual (1, dataView.Count, "Deleted.Count");
+                       Assert.AreEqual ("1", v, "Deleted.Value");
                }
 
                //xamarin bug #18898 # / novell bug #595899
@@ -276,10 +276,10 @@ namespace MonoTests.System.Data
                        another_new_row[0] = "9";
                        another_new_row[1] = "10";
 
-                       AssertEquals ("#1", dv[2][0], "9");
+                       Assert.AreEqual (dv[2][0], "9", "#1");
 
                        //This should not throw a System.Data.VersionNotFoundException: "There is no Proposed data to accces"
-                       AssertEquals ("#1", dv[1][0], "7");     
+                       Assert.AreEqual (dv[1][0], "7", "#1");  
 
                }
 
@@ -288,7 +288,7 @@ namespace MonoTests.System.Data
                {
                        DataView dataview = new DataView ();
                        PropertyDescriptorCollection col = ((ITypedList)dataview).GetItemProperties (null);
-                       AssertEquals ("1", 0, col.Count);
+                       Assert.AreEqual (0, col.Count, "1");
                }
 
                #region Sort Tests
@@ -296,7 +296,7 @@ namespace MonoTests.System.Data
                public void SortListChangedTest ()
                {
                        dataView.Sort = "itemName DESC";
-                       AssertEquals ("test#01",ListChangedType.Reset,listChangedArgs.ListChangedType);
+                       Assert.AreEqual (ListChangedType.Reset,listChangedArgs.ListChangedType, "test#01");
                        // UnComment the line below to see if dataView is sorted
                        // PrintTableOrView (dataView);
                }
@@ -338,60 +338,60 @@ namespace MonoTests.System.Data
                        DataView dataView = dataTable.DefaultView;
 
                        string s = "Default sorting: ";
-                       AssertEquals (s + "First entry has wrong item", 1, dataView[0][0]);
-                       AssertEquals (s + "Second entry has wrong item", 0, dataView[1][0]);
-                       AssertEquals (s + "Third entry has wrong item", 3, dataView[2][0]);
-                       AssertEquals (s + "Fourth entry has wrong item", 2, dataView[3][0]);
+                       Assert.AreEqual (1, dataView[0][0], s + "First entry has wrong item");
+                       Assert.AreEqual (0, dataView[1][0], s + "Second entry has wrong item");
+                       Assert.AreEqual (3, dataView[2][0], s + "Third entry has wrong item");
+                       Assert.AreEqual (2, dataView[3][0], s + "Fourth entry has wrong item");
 
                        s = "Ascending sorting 1: ";
                        dataView.Sort = "itemId ASC";
-                       AssertEquals (s + "First entry has wrong item", 0, dataView[0][0]);
-                       AssertEquals (s + "Second entry has wrong item", 1, dataView[1][0]);
-                       AssertEquals (s + "Third entry has wrong item", 2, dataView[2][0]);
-                       AssertEquals (s + "Fourth entry has wrong item", 3, dataView[3][0]);
+                       Assert.AreEqual (0, dataView[0][0], s + "First entry has wrong item");
+                       Assert.AreEqual (1, dataView[1][0], s + "Second entry has wrong item");
+                       Assert.AreEqual (2, dataView[2][0], s + "Third entry has wrong item");
+                       Assert.AreEqual (3, dataView[3][0], s + "Fourth entry has wrong item");
 
                        // bug #77104 (2-5)
                        s = "Ascending sorting 2: ";
                        dataView.Sort = "itemId     ASC";
-                       AssertEquals (s + "First entry has wrong item", 0, dataView[0][0]);
-                       AssertEquals (s + "Second entry has wrong item", 1, dataView[1][0]);
-                       AssertEquals (s + "Third entry has wrong item", 2, dataView[2][0]);
-                       AssertEquals (s + "Fourth entry has wrong item", 3, dataView[3][0]);
+                       Assert.AreEqual (0, dataView[0][0], s + "First entry has wrong item");
+                       Assert.AreEqual (1, dataView[1][0], s + "Second entry has wrong item");
+                       Assert.AreEqual (2, dataView[2][0], s + "Third entry has wrong item");
+                       Assert.AreEqual (3, dataView[3][0], s + "Fourth entry has wrong item");
 
                        s = "Ascending sorting 3: ";
                        dataView.Sort = "[itemId] ASC";
-                       AssertEquals (s + "First entry has wrong item", 0, dataView[0][0]);
-                       AssertEquals (s + "Second entry has wrong item", 1, dataView[1][0]);
-                       AssertEquals (s + "Third entry has wrong item", 2, dataView[2][0]);
-                       AssertEquals (s + "Fourth entry has wrong item", 3, dataView[3][0]);
+                       Assert.AreEqual (0, dataView[0][0], s + "First entry has wrong item");
+                       Assert.AreEqual (1, dataView[1][0], s + "Second entry has wrong item");
+                       Assert.AreEqual (2, dataView[2][0], s + "Third entry has wrong item");
+                       Assert.AreEqual (3, dataView[3][0], s + "Fourth entry has wrong item");
 
                        s = "Ascending sorting 4: ";
                        dataView.Sort = "[itemId]       ASC";
-                       AssertEquals (s + "First entry has wrong item", 0, dataView[0][0]);
-                       AssertEquals (s + "Second entry has wrong item", 1, dataView[1][0]);
-                       AssertEquals (s + "Third entry has wrong item", 2, dataView[2][0]);
-                       AssertEquals (s + "Fourth entry has wrong item", 3, dataView[3][0]);
+                       Assert.AreEqual (0, dataView[0][0], s + "First entry has wrong item");
+                       Assert.AreEqual (1, dataView[1][0], s + "Second entry has wrong item");
+                       Assert.AreEqual (2, dataView[2][0], s + "Third entry has wrong item");
+                       Assert.AreEqual (3, dataView[3][0], s + "Fourth entry has wrong item");
 
                        s = "Ascending sorting 5: ";
                        try {
                                dataView.Sort = "itemId \tASC";
-                               AssertEquals (s + "Tab cannot be a separator" , true, false);
+                               Assert.AreEqual (true, false, s + "Tab cannot be a separator");
                        }catch (IndexOutOfRangeException e) {
                        }
 
                        s = "Descending sorting : ";
                        dataView.Sort = "itemId DESC";
-                       AssertEquals (s + "First entry has wrong item", 3, dataView[0][0]);
-                       AssertEquals (s + "Second entry has wrong item", 2, dataView[1][0]);
-                       AssertEquals (s + "Third entry has wrong item", 1, dataView[2][0]);
-                       AssertEquals (s + "Fourth entry has wrong item", 0, dataView[3][0]);
+                       Assert.AreEqual (3, dataView[0][0], s + "First entry has wrong item");
+                       Assert.AreEqual (2, dataView[1][0], s + "Second entry has wrong item");
+                       Assert.AreEqual (1, dataView[2][0], s + "Third entry has wrong item");
+                       Assert.AreEqual (0, dataView[3][0], s + "Fourth entry has wrong item");
 
                        s = "Reverted to default sorting: ";
                        dataView.Sort = null;
-                       AssertEquals (s + "First entry has wrong item", 1, dataView[0][0]);
-                       AssertEquals (s + "Second entry has wrong item", 0, dataView[1][0]);
-                       AssertEquals (s + "Third entry has wrong item", 3, dataView[2][0]);
-                       AssertEquals (s + "Fourth entry has wrong item", 2, dataView[3][0]);
+                       Assert.AreEqual (1, dataView[0][0], s + "First entry has wrong item");
+                       Assert.AreEqual (0, dataView[1][0], s + "Second entry has wrong item");
+                       Assert.AreEqual (3, dataView[2][0], s + "Third entry has wrong item");
+                       Assert.AreEqual (2, dataView[3][0], s + "Fourth entry has wrong item");
                }
                
                #endregion // Sort Tests
@@ -409,21 +409,21 @@ namespace MonoTests.System.Data
                {
                        dataView.AllowNew = true;
                        DataRowView drv = dataView.AddNew ();
-                       AssertEquals ("test#01",ListChangedType.ItemAdded,listChangedArgs.ListChangedType);
-                       AssertEquals ("test#02",-1,listChangedArgs.OldIndex);
-                       AssertEquals ("test#03",5,listChangedArgs.NewIndex);
-                       AssertEquals ("test#04",drv["itemName"],dataView [dataView.Count - 1]["itemName"]);
+                       Assert.AreEqual (ListChangedType.ItemAdded,listChangedArgs.ListChangedType, "test#01");
+                       Assert.AreEqual (-1,listChangedArgs.OldIndex, "test#02");
+                       Assert.AreEqual (5,listChangedArgs.NewIndex, "test#03");
+                       Assert.AreEqual (drv["itemName"],dataView [dataView.Count - 1]["itemName"], "test#04");
                        listChangedArgs = null;
                        drv["itemId"] = "item " + 1001;
                        drv["itemName"] = "name " + rndm.Next();
                        drv["itemPrice"] = "Rs. " + (rndm.Next() % 1000);
                        drv["itemCategory"] = "Cat " + ((rndm.Next() % 10) + 1);
                        // Actually no events are arisen when items are set.
-                       AssertNull ("test#05", listChangedArgs);
+                       Assert.IsNull (listChangedArgs, "test#05");
                        drv.CancelEdit ();
-                       AssertEquals ("test#06",ListChangedType.ItemDeleted,listChangedArgs.ListChangedType);
-                       AssertEquals ("test#07",-1,listChangedArgs.OldIndex);
-                       AssertEquals ("test#08",5,listChangedArgs.NewIndex);
+                       Assert.AreEqual (ListChangedType.ItemDeleted,listChangedArgs.ListChangedType, "test#06");
+                       Assert.AreEqual (-1,listChangedArgs.OldIndex, "test#07");
+                       Assert.AreEqual (5,listChangedArgs.NewIndex, "test#08");
                }
 
                [Test]
@@ -439,15 +439,15 @@ namespace MonoTests.System.Data
                        table.Columns.AddRange (new DataColumn[] {col1,col2});
 
                        dv.Table = table;
-                       AssertNull ("#1", dv.Table);
+                       Assert.IsNull (dv.Table, "#1");
                        dv.EndInit ();
 
-                       AssertNull ("#2", dv.Table); // still.
-                       AssertEquals ("#3", 0, table.Columns.Count);
+                       Assert.IsNull (dv.Table, "#2"); // still.
+                       Assert.AreEqual (0, table.Columns.Count, "#3");
 
                        table.EndInit ();
-                       AssertEquals ("#5", table, dv.Table);
-                       AssertEquals ("#4", 2, table.Columns.Count);
+                       Assert.AreEqual (table, dv.Table, "#4");
+                       Assert.AreEqual (2, table.Columns.Count, "#5");
                }
 
                private bool dvInitialized;
@@ -472,19 +472,19 @@ namespace MonoTests.System.Data
                        table.Columns.AddRange (new DataColumn[] {col1,col2});
 
                        dv.Table = table;
-                       AssertNull ("#1", dv.Table);
+                       Assert.IsNull (dv.Table, "#1");
                        dv.EndInit ();
                        
-                       AssertNull ("#2", dv.Table);
-                       AssertEquals ("#3", 0, table.Columns.Count);
+                       Assert.IsNull (dv.Table, "#2");
+                       Assert.AreEqual (0, table.Columns.Count, "#3");
 
                        table.EndInit ();
 
                        dv.Initialized -= new EventHandler (OnDataViewInitialized); // this should not be unregistered before table.EndInit().
                        
-                       AssertEquals ("#4", 2, table.Columns.Count);
-                       AssertEquals ("#6", table, dv.Table);
-                       AssertEquals ("DataViewInitialized #5", true, dvInitialized);
+                       Assert.AreEqual (2, table.Columns.Count, "#4");
+                       Assert.AreEqual (table, dv.Table, "#6");
+                       Assert.AreEqual (true, dvInitialized, "DataViewInitialized #5");
                }
 
                [Test]
@@ -503,21 +503,21 @@ namespace MonoTests.System.Data
                        randInt = rndm.Next () % rowCount;
                        dataView.Sort = "itemId";
                        drv = dataView [randInt];
-                       AssertEquals ("test#01",randInt,dataView.Find (drv ["itemId"]));
+                       Assert.AreEqual (randInt,dataView.Find (drv ["itemId"]), "test#01");
                        
                        dataView.Sort = "itemId DESC";
                        drv = dataView [randInt];
-                       AssertEquals ("test#02",randInt,dataView.Find (drv ["itemId"]));
+                       Assert.AreEqual (randInt,dataView.Find (drv ["itemId"]), "test#02");
                        
                        dataView.Sort = "itemId, itemName";
                        drv = dataView [randInt];
                        object [] keys = new object [2];
                        keys [0] = drv ["itemId"];
                        keys [1] = drv ["itemName"];
-                       AssertEquals ("test#03",randInt,dataView.Find (keys));
+                       Assert.AreEqual (randInt,dataView.Find (keys), "test#03");
                        
                        dataView.Sort = "itemId";
-                       AssertEquals ("test#04",-1,dataView.Find("no item"));
+                       Assert.AreEqual (-1,dataView.Find("no item"), "test#04");
 
                }
 
@@ -540,7 +540,7 @@ namespace MonoTests.System.Data
                [Test]
                public void ToStringTest ()
                {
-                       AssertEquals ("test#01","System.Data.DataView",dataView.ToString());
+                       Assert.AreEqual ("System.Data.DataView",dataView.ToString(), "test#01");
                }
 
                [Test]
@@ -556,38 +556,38 @@ namespace MonoTests.System.Data
                        dataTable.Rows.Add(dr);
 
                        //PrintTableOrView(dataView, "ItemAdded");
-                       AssertEquals ("test#01",ListChangedType.ItemAdded,listChangedArgs.ListChangedType);
+                       Assert.AreEqual (ListChangedType.ItemAdded,listChangedArgs.ListChangedType, "test#01");
                        listChangedArgs = null;
 
                        dr ["itemId"] = "aitem 0";
                        // PrintTableOrView(dataView, "ItemChanged");
-                       AssertEquals ("test#02",ListChangedType.ItemChanged,listChangedArgs.ListChangedType);
+                       Assert.AreEqual (ListChangedType.ItemChanged,listChangedArgs.ListChangedType, "test#02");
                        listChangedArgs = null;
 
                        dr ["itemId"] = "zitem 0";
                        // PrintTableOrView(dataView, "ItemMoved");
-                       AssertEquals ("test#03",ListChangedType.ItemMoved,listChangedArgs.ListChangedType);
+                       Assert.AreEqual (ListChangedType.ItemMoved,listChangedArgs.ListChangedType, "test#03");
                        listChangedArgs = null;
 
                        dataTable.Rows.Remove (dr);
                        // PrintTableOrView(dataView, "ItemDeleted");
-                       AssertEquals ("test#04",ListChangedType.ItemDeleted,listChangedArgs.ListChangedType);
+                       Assert.AreEqual (ListChangedType.ItemDeleted,listChangedArgs.ListChangedType, "test#04");
                        
                        listChangedArgs = null;
                        DataColumn dc5 = new DataColumn ("itemDesc");
                        dataTable.Columns.Add (dc5);
                        // PrintTableOrView(dataView, "PropertyDescriptorAdded");
-                       AssertEquals ("test#05",ListChangedType.PropertyDescriptorAdded,listChangedArgs.ListChangedType);
+                       Assert.AreEqual (ListChangedType.PropertyDescriptorAdded,listChangedArgs.ListChangedType, "test#05");
                        
                        listChangedArgs = null;
                        dc5.ColumnName = "itemDescription";
                        // PrintTableOrView(dataView, "PropertyDescriptorChanged");
-                       // AssertEquals ("test#06",ListChangedType.PropertyDescriptorChanged,listChangedArgs.ListChangedType);
+                       // Assert.AreEqual ("test#06",ListChangedType.PropertyDescriptorChanged,listChangedArgs.ListChangedType);
                        
                        listChangedArgs = null;
                        dataTable.Columns.Remove (dc5);
                        // PrintTableOrView(dataView, "PropertyDescriptorDeleted");
-                       AssertEquals ("test#07",ListChangedType.PropertyDescriptorDeleted,listChangedArgs.ListChangedType);
+                       Assert.AreEqual (ListChangedType.PropertyDescriptorDeleted,listChangedArgs.ListChangedType, "test#07");
                }
        
                [Test]
@@ -596,8 +596,8 @@ namespace MonoTests.System.Data
                        DataView TestView = new DataView (dataTable);
                        TestView.Sort = "itemId";
                        DataRowView[] Result = TestView.FindRows ("item 3");
-                       Assertion.AssertEquals ("Dv #1", 1, Result.Length);
-                       Assertion.AssertEquals ("Dv #2", "item 3", Result [0]["itemId"]);
+                       Assert.AreEqual (1, Result.Length, "Dv #1");
+                       Assert.AreEqual ("item 3", Result [0]["itemId"], "Dv #2");
                }
 
                [Test]
@@ -642,7 +642,7 @@ namespace MonoTests.System.Data
                        DataView TestView = new DataView (dataTable);
                        TestView.Delete (0);
                        DataRow r = TestView.Table.Rows [0];
-                       Assertion.Assert ("Dv #1", !((string)r ["itemId"] == "item 1"));
+                       Assert.IsTrue (!((string)r ["itemId"] == "item 1"), "Dv #1");
                }
 
                [Test]
@@ -685,13 +685,13 @@ namespace MonoTests.System.Data
 
                        DataView dataView = new DataView (dataset.Tables[0]);
 
-                       AssertEquals ("before delete", 3, dataView.Count);
+                       Assert.AreEqual (3, dataView.Count, "before delete");
                        dataView.AllowDelete = true;
 
                        // Deleting the first row
                        dataView.Delete (0);
 
-                       AssertEquals ("before delete", 2, dataView.Count);
+                       Assert.AreEqual (2, dataView.Count, "before delete");
                }
 
                [Test]
@@ -746,7 +746,7 @@ namespace MonoTests.System.Data
                        eventWriter.Write (" ------" + dv.Count);
                        DataRowView a3 = dv.AddNew ();
 
-                       AssertEquals (reference, eventWriter.ToString ());
+                       Assert.AreEqual (reference, eventWriter.ToString ());
                }
 
                [Test]
@@ -766,7 +766,7 @@ table was set.
 
                        dc2.ColumnName = "new_column_name";
 
-                       AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
+                       Assert.AreEqual (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
                }
 
                private void ListChanged (object o, ListChangedEventArgs e)
@@ -830,7 +830,7 @@ removed relation 2
                        ds.Relations.Remove (dr);
                        eventWriter.WriteLine ("removed relation 2");
 
-                       AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
+                       Assert.AreEqual (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
                }
 
                [Test]
@@ -942,7 +942,7 @@ table changed.
                        dv.Table = new DataTable ("table2");
                        eventWriter.WriteLine ("table changed.");
 
-                       AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
+                       Assert.AreEqual (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
                }
 
                [Test]
@@ -982,7 +982,7 @@ table was set.
                        dt.Columns.Add ("");
                        eventWriter.WriteLine (" add a column with an empty name.");
 
-                       AssertEquals (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
+                       Assert.AreEqual (result.Replace ("\r\n", "\n"), eventWriter.ToString ().Replace ("\r\n", "\n"));
                        GC.KeepAlive (dv);
                }
 
index 6e5d2a4df927114b5c0499ff38153f2b41c00ba5..21742eb3aa3cef106b3dd46a42018b4ba70a5d05 100644 (file)
@@ -38,7 +38,7 @@ using System.Data;
 namespace MonoTests.System.Data
 {
        [TestFixture]
-       public class ForeignKeyConstraintTest : Assertion
+       public class ForeignKeyConstraintTest
        {
                private DataSet _ds;
 
@@ -73,23 +73,23 @@ namespace MonoTests.System.Data
                {
                        DataTable Table =  _ds.Tables [0];
                        
-                       AssertEquals ("test#01", 0, Table.Constraints.Count);
+                       Assert.AreEqual (0, Table.Constraints.Count, "test#01");
                        Table =  _ds.Tables [1];
-                       AssertEquals ("test#02", 0, Table.Constraints.Count);
+                       Assert.AreEqual (0, Table.Constraints.Count, "test#02");
                        
                        // ctor (string, DataColumn, DataColumn
                        ForeignKeyConstraint Constraint = new ForeignKeyConstraint ("test", _ds.Tables [0].Columns [2], _ds.Tables [1].Columns [0]);
                        Table = _ds.Tables [1];
                        Table.Constraints.Add (Constraint);
                        
-                       AssertEquals ("test#03", 1, Table.Constraints.Count);
-                       AssertEquals ("test#04", "test", Table.Constraints [0].ConstraintName);
-                       AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [0].GetType ());
+                       Assert.AreEqual (1, Table.Constraints.Count, "test#03");
+                       Assert.AreEqual ("test", Table.Constraints [0].ConstraintName, "test#04");
+                       Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [0].GetType (), "test#05");
 
                        Table = _ds.Tables [0];
-                       AssertEquals ("test#06", 1, Table.Constraints.Count);
-                       AssertEquals ("test#07", "Constraint1", Table.Constraints [0].ConstraintName);
-                       AssertEquals ("test#08", typeof (UniqueConstraint), Table.Constraints [0].GetType ());
+                       Assert.AreEqual (1, Table.Constraints.Count, "test#06");
+                       Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#07");
+                       Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#08");
                }
                
                // Tests ctor (DataColumn, DataColumn)
@@ -98,23 +98,23 @@ namespace MonoTests.System.Data
                {
                        DataTable Table =  _ds.Tables [0];
                        
-                       AssertEquals ("test#01", 0, Table.Constraints.Count);
+                       Assert.AreEqual (0, Table.Constraints.Count, "test#01");
                        Table =  _ds.Tables [1];
-                       AssertEquals ("test#02", 0, Table.Constraints.Count);
+                       Assert.AreEqual (0, Table.Constraints.Count, "test#02");
                        
                        // ctor (string, DataColumn, DataColumn
                        ForeignKeyConstraint Constraint = new ForeignKeyConstraint (_ds.Tables [0].Columns [2], _ds.Tables [1].Columns [0]);
                        Table = _ds.Tables [1];
                        Table.Constraints.Add (Constraint);
                        
-                       AssertEquals ("test#03", 1, Table.Constraints.Count);
-                       AssertEquals ("test#04", "Constraint1", Table.Constraints [0].ConstraintName);
-                       AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [0].GetType ());
+                       Assert.AreEqual (1, Table.Constraints.Count, "test#03");
+                       Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#04");
+                       Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [0].GetType (), "test#05");
 
                        Table = _ds.Tables [0];
-                       AssertEquals ("test#06", 1, Table.Constraints.Count);
-                       AssertEquals ("test#07", "Constraint1", Table.Constraints [0].ConstraintName);
-                       AssertEquals ("test#08", typeof (UniqueConstraint), Table.Constraints [0].GetType ());
+                       Assert.AreEqual (1, Table.Constraints.Count, "test#06");
+                       Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#07");
+                       Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#08");
                }
                
                // Test ctor (DataColumn [], DataColumn [])
@@ -123,9 +123,9 @@ namespace MonoTests.System.Data
                {
                        DataTable Table =  _ds.Tables [0];
                        
-                       AssertEquals ("test#01", 0, Table.Constraints.Count);
+                       Assert.AreEqual (0, Table.Constraints.Count, "test#01");
                        Table =  _ds.Tables [1];
-                       AssertEquals ("test#02", 0, Table.Constraints.Count);
+                       Assert.AreEqual (0, Table.Constraints.Count, "test#02");
                                                
                        DataColumn [] Cols1 = new DataColumn [2];
                        Cols1 [0] = _ds.Tables [0].Columns [1];
@@ -139,14 +139,14 @@ namespace MonoTests.System.Data
                        Table = _ds.Tables [1];
                        Table.Constraints.Add (Constraint);
                        
-                       AssertEquals ("test#03", 1, Table.Constraints.Count);
-                       AssertEquals ("test#04", "Constraint1", Table.Constraints [0].ConstraintName);
-                       AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [0].GetType ());
+                       Assert.AreEqual (1, Table.Constraints.Count, "test#03");
+                       Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#04");
+                       Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [0].GetType (), "test#05");
 
                        Table = _ds.Tables [0];
-                       AssertEquals ("test#06", 1, Table.Constraints.Count);
-                       AssertEquals ("test#07", "Constraint1", Table.Constraints [0].ConstraintName);
-                       AssertEquals ("test#08", typeof (UniqueConstraint), Table.Constraints [0].GetType ());
+                       Assert.AreEqual (1, Table.Constraints.Count, "test#06");
+                       Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#07");
+                       Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#08");
 
                }
        
@@ -156,9 +156,9 @@ namespace MonoTests.System.Data
                {
                        DataTable Table =  _ds.Tables [0];
                        
-                       AssertEquals ("test#01", 0, Table.Constraints.Count);
+                       Assert.AreEqual (0, Table.Constraints.Count, "test#01");
                        Table =  _ds.Tables [1];
-                       AssertEquals ("test#02", 0, Table.Constraints.Count);
+                       Assert.AreEqual (0, Table.Constraints.Count, "test#02");
                                                
                        DataColumn [] Cols1 = new DataColumn [2];
                        Cols1 [0] = _ds.Tables [0].Columns [1];
@@ -172,14 +172,14 @@ namespace MonoTests.System.Data
                        Table = _ds.Tables [1];
                        Table.Constraints.Add (Constraint);
                        
-                       AssertEquals ("test#03", 1, Table.Constraints.Count);
-                       AssertEquals ("test#04", "Test", Table.Constraints [0].ConstraintName);
-                       AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [0].GetType ());
+                       Assert.AreEqual (1, Table.Constraints.Count, "test#03");
+                       Assert.AreEqual ("Test", Table.Constraints [0].ConstraintName, "test#04");
+                       Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [0].GetType (), "test#05");
 
                        Table = _ds.Tables [0];
-                       AssertEquals ("test#06", 1, Table.Constraints.Count);
-                       AssertEquals ("test#07", "Constraint1", Table.Constraints [0].ConstraintName);
-                       AssertEquals ("test#08", typeof (UniqueConstraint), Table.Constraints [0].GetType ());                  
+                       Assert.AreEqual (1, Table.Constraints.Count, "test#06");
+                       Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#07");
+                       Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#08");
                }
                
                [Test]
@@ -211,7 +211,7 @@ namespace MonoTests.System.Data
                         ForeignKeyConstraint fkc = new ForeignKeyConstraint ("hello world", parentTableName, parentColumnNames, childColumnNames, AcceptRejectRule.Cascade, Rule.Cascade, Rule.Cascade);                                                                                                                            // Assert that the Constraint object does not belong to any table yet
                        try {
                                DataTable tmp = fkc.Table;
-                               Fail ("When table is null, get_Table causes an InvalidOperationException.");
+                               Assert.Fail ("When table is null, get_Table causes an InvalidOperationException.");
                        } catch (NullReferenceException) { // actually .NET throws this (bug)
                        } catch (InvalidOperationException) {
                        }
@@ -234,9 +234,12 @@ namespace MonoTests.System.Data
                         // OK - So AddRange() is the only way!
                         table2.Constraints.AddRange (constraints);
                           // After AddRange(), Check the properties of ForeignKeyConstraint object
-                        Assertion.Assert("#A04", fkc.RelatedColumns [0].ColumnName.Equals ("col1"));                        Assertion.Assert("#A05", fkc.RelatedColumns [1].ColumnName.Equals ("col2"));                        Assertion.Assert("#A06", fkc.RelatedColumns [2].ColumnName.Equals ("col3"));                        Assertion.Assert("#A07", fkc.Columns [0].ColumnName.Equals ("col4"));
-                        Assertion.Assert("#A08", fkc.Columns [1].ColumnName.Equals ("col5"));
-                        Assertion.Assert("#A09", fkc.Columns [2].ColumnName.Equals ("col6"));
+                        Assert.IsTrue(fkc.RelatedColumns [0].ColumnName.Equals ("col1"), "#A04");
+                        Assert.IsTrue(fkc.RelatedColumns [1].ColumnName.Equals ("col2"), "#A05");
+                        Assert.IsTrue(fkc.RelatedColumns [2].ColumnName.Equals ("col3"), "#A06");
+                        Assert.IsTrue(fkc.Columns [0].ColumnName.Equals ("col4"), "#A07");
+                        Assert.IsTrue(fkc.Columns [1].ColumnName.Equals ("col5"), "#A08");
+                        Assert.IsTrue(fkc.Columns [2].ColumnName.Equals ("col6"), "#A09");
 #endif
                         // Try to add columns with names which do not exist in the table
                         parentColumnNames [2] = "noColumn";
@@ -255,7 +258,7 @@ namespace MonoTests.System.Data
                         
 #if false // FIXME: Here this test crashes under MS.NET.
                         // Check whether the child table really contains the foreign key constraint named "hello world"
-                        Assertion.Assert("#A11 ", table2.Constraints.Contains ("hello world"));
+                        Assert.IsTrue(table2.Constraints.Contains ("hello world"), "#A11 ");
 #endif
                 }
 
@@ -267,20 +270,20 @@ namespace MonoTests.System.Data
                {
                        DataTable Table =  _ds.Tables [0];
                        
-                       AssertEquals ("test#01", 0, Table.Constraints.Count);
+                       Assert.AreEqual (0, Table.Constraints.Count, "test#01");
                        Table =  _ds.Tables [1];
-                       AssertEquals ("test#02", 0, Table.Constraints.Count);
+                       Assert.AreEqual (0, Table.Constraints.Count, "test#02");
                                                
                        
                        ForeignKeyConstraint Constraint = new ForeignKeyConstraint ("Test", _ds.Tables [0].Columns [0], _ds.Tables [0].Columns [2]);
                        Table = _ds.Tables [0];
                        Table.Constraints.Add (Constraint);
                        
-                       AssertEquals ("test#03", 2, Table.Constraints.Count);
-                       AssertEquals ("test#04", "Constraint1", Table.Constraints [0].ConstraintName);
-                       AssertEquals ("test#05", typeof (UniqueConstraint), Table.Constraints [0].GetType ());
-                       AssertEquals ("test#04", "Test", Table.Constraints [1].ConstraintName);
-                       AssertEquals ("test#05", typeof (ForeignKeyConstraint), Table.Constraints [1].GetType ());
+                       Assert.AreEqual (2, Table.Constraints.Count, "test#03");
+                       Assert.AreEqual ("Constraint1", Table.Constraints [0].ConstraintName, "test#04");
+                       Assert.AreEqual (typeof (UniqueConstraint), Table.Constraints [0].GetType (), "test#05");
+                       Assert.AreEqual ("Test", Table.Constraints [1].ConstraintName, "test#04");
+                       Assert.AreEqual (typeof (ForeignKeyConstraint), Table.Constraints [1].GetType (), "test#05");
 
                }
 
@@ -297,45 +300,45 @@ namespace MonoTests.System.Data
                        try
                        {
                                fkc = new ForeignKeyConstraint((DataColumn)null,(DataColumn)null);
-                               Fail("Failed to throw ArgumentNullException.");
+                               Assert.Fail("Assert.Failed to throw ArgumentNullException.");
                        }
                        catch (NullReferenceException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch (Exception exc)
                        {
-                               Fail("A1: Wrong Exception type. " + exc.ToString());
+                               Assert.Fail("A1: Wrong Exception type. " + exc.ToString());
                        }
 
                        //zero length collection
                        try
                        {
                                fkc = new ForeignKeyConstraint(new DataColumn[]{},new DataColumn[]{});
-                               Fail("B1: Failed to throw ArgumentException.");
+                               Assert.Fail("B1: Assert.Failed to throw ArgumentException.");
                        }
                        catch (ArgumentException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch (Exception exc)
                        {
-                               Fail("A2: Wrong Exception type. " + exc.ToString());
+                               Assert.Fail("A2: Wrong Exception type. " + exc.ToString());
                        }
 
                        //different datasets
                        try
                        {
                                fkc = new ForeignKeyConstraint(_ds.Tables[0].Columns[0], localTable.Columns[0]);
-                               Fail("Failed to throw InvalidOperationException.");
+                               Assert.Fail("Assert.Failed to throw InvalidOperationException.");
                        }
                        catch (InvalidOperationException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch (Exception exc)
                        {
-                               Fail("A3: Wrong Exception type. " + exc.ToString());
+                               Assert.Fail("A3: Wrong Exception type. " + exc.ToString());
                        }
 
                        try
                        {
                                fkc = new ForeignKeyConstraint(_ds.Tables[0].Columns[0], localTable.Columns[1]);
-                               Fail("Failed to throw InvalidConstraintException.");
+                               Assert.Fail("Assert.Failed to throw InvalidConstraintException.");
                        }
                        // tables in different datasets
                        catch (InvalidOperationException) {}
@@ -345,7 +348,7 @@ namespace MonoTests.System.Data
                         try                                           
                         {                                             
                                 fkc = new ForeignKeyConstraint(new DataColumn [] {_ds.Tables[0].Columns[0], _ds.Tables[0].Columns[1]}, new DataColumn [] {localTable.Columns[1], _ds.Tables[1].Columns [0]});    
-                                Fail("Failed to throw InvalidOperationException.");                                         
+                                Assert.Fail("Assert.Failed to throw InvalidOperationException.");                                         
                         }                                             
                         catch (InvalidConstraintException) {}         
                         catch (AssertionException exc) {throw exc;} 
@@ -362,13 +365,13 @@ namespace MonoTests.System.Data
                        try 
                        {
                                fkc = new ForeignKeyConstraint(col, _ds.Tables[0].Columns[0]);
-                               Fail("FTT1: Failed to throw ArgumentException.");
+                               Assert.Fail("FTT1: Assert.Failed to throw ArgumentException.");
                        }
                        catch (ArgumentException) {}
                        catch (AssertionException exc) {throw exc;}
 //                     catch (Exception exc)
 //                     {
-//                             Fail("WET1: Wrong Exception type. " + exc.ToString());
+//                             Assert.Fail("WET1: Wrong Exception type. " + exc.ToString());
 //                     }
 
                        //Columns must belong to the same table
@@ -382,13 +385,13 @@ namespace MonoTests.System.Data
                                                                 _ds.Tables[0].Columns[1],
                                                                _ds.Tables[0].Columns[0]});
                                        
-                               Fail("FTT2: Failed to throw InvalidConstraintException.");
+                               Assert.Fail("FTT2: Assert.Failed to throw InvalidConstraintException.");
                        }
                        catch (InvalidConstraintException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch (Exception exc)
                        {
-                               Fail("WET2: Wrong Exception type. " + exc.ToString());
+                               Assert.Fail("WET2: Wrong Exception type. " + exc.ToString());
                        }
 
 
@@ -403,13 +406,13 @@ namespace MonoTests.System.Data
                                fkc = new ForeignKeyConstraint(twoCol, 
                                        new DataColumn[] { _ds.Tables[0].Columns[0]});
                                        
-                               Fail("FTT3: Failed to throw ArgumentException.");
+                               Assert.Fail("FTT3: Assert.Failed to throw ArgumentException.");
                        }
                        catch (ArgumentException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch (Exception exc)
                        {
-                               Fail("WET3: Wrong Exception type. " + exc.ToString());
+                               Assert.Fail("WET3: Wrong Exception type. " + exc.ToString());
                        }
 
                        //InvalidOperation: Parent and child are the same column.
@@ -418,13 +421,13 @@ namespace MonoTests.System.Data
                                fkc = new ForeignKeyConstraint( _ds.Tables[0].Columns[0],
                                        _ds.Tables[0].Columns[0] );
                                        
-                               Fail("FTT4: Failed to throw InvalidOperationException.");
+                               Assert.Fail("FTT4: Assert.Failed to throw InvalidOperationException.");
                        }
                        catch (InvalidOperationException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch (Exception exc)
                        {
-                               Fail("WET4: Wrong Exception type. " + exc.ToString());
+                               Assert.Fail("WET4: Wrong Exception type. " + exc.ToString());
                        }
 
                }
@@ -446,14 +449,14 @@ namespace MonoTests.System.Data
                        ForeignKeyConstraint fkcDiff = 
                                new ForeignKeyConstraint( tbl.Columns[1], tbl.Columns[2]);
                
-                       Assert( "Equals failed. 1" , fkc.Equals(fkc2));
-                       Assert( "Equals failed. 2" , fkc2.Equals(fkc));
-                       Assert( "Equals failed. 3" , fkc.Equals(fkc));
+                       Assert.IsTrue( fkc.Equals(fkc2) , "Equals Assert.IsTrue.Failed. 1");
+                       Assert.IsTrue( fkc2.Equals(fkc) , "Equals Assert.IsTrue.Failed. 2");
+                       Assert.IsTrue( fkc.Equals(fkc) , "Equals Assert.IsTrue.Failed. 3");
 
-                       Assert( "Equals failed diff. 1" , fkc.Equals(fkcDiff) == false);
+                       Assert.IsTrue( fkc.Equals(fkcDiff) == false , "Equals Assert.IsTrue.Failed diff. 1");
 
-                       //Assert( "Hash Code Failed. 1", fkc.GetHashCode() == fkc2.GetHashCode() );
-                       Assert( "Hash Code Failed. 2", fkc.GetHashCode() != fkcDiff.GetHashCode() );
+                       //Assert.IsTrue( "Hash Code Assert.IsTrue.Failed. 1", fkc.GetHashCode() == fkc2.GetHashCode() );
+                       Assert.IsTrue( fkc.GetHashCode() != fkcDiff.GetHashCode() , "Hash Code Assert.IsTrue.Failed. 2");
        
                }
 
@@ -512,7 +515,7 @@ namespace MonoTests.System.Data
                        t2.Rows.Add (new object [] {10});
 
                        t1.Rows [0][0]=20;
-                       Assert("#1", (int)t2.Rows [0][0] == 20);
+                       Assert.IsTrue((int)t2.Rows [0][0] == 20, "#1");
                }
 
                [Test]
index cc8196e0c9681eb1f568b93e8cc7f6ccb8e2b72c..0a99b71bc323319293eddc6fbbfde4d7053512f7 100644 (file)
@@ -38,7 +38,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Xml
 {
        [TestFixture]
-       public class XmlDataDocumentTest2 : Assertion
+       public class XmlDataDocumentTest2 
        {
                string xml = "<NewDataSet><table><row><col1>1</col1><col2>2</col2></row></table></NewDataSet>";
 
@@ -53,8 +53,8 @@ namespace MonoTests.System.Xml
                public void TestDefaultCtor ()
                {
                        XmlDataDocument doc = new XmlDataDocument ();
-                       AssertNotNull (doc.DataSet);
-                       AssertEquals ("NewDataSet", doc.DataSet.DataSetName);
+                       Assert.IsNotNull (doc.DataSet);
+                       Assert.AreEqual ("NewDataSet", doc.DataSet.DataSetName);
                }
 
                [Test]
@@ -117,73 +117,73 @@ namespace MonoTests.System.Xml
                        ds.Relations.Add (rel);\r
                        XmlDataDocument doc = new XmlDataDocument (ds);\r
                        doc.LoadXml ("<set><tab1><col1>1</col1><col2/><child><ref>1</ref><val>aaa</val></child></tab1></set>");\r
-                       AssertEquals (1, ds.Tables [0].Rows.Count);\r
-                       AssertEquals (1, ds.Tables [1].Rows.Count);\r
+                       Assert.AreEqual (1, ds.Tables [0].Rows.Count);\r
+                       Assert.AreEqual (1, ds.Tables [1].Rows.Count);\r
 \r
                        // document element - no mapped row\r
                        XmlElement el = doc.DocumentElement;\r
-                       AssertNull (doc.GetRowFromElement (el));\r
+                       Assert.IsNull (doc.GetRowFromElement (el));\r
 \r
                        // tab1 element - has mapped row\r
                        el = el.FirstChild as XmlElement;\r
                        DataRow row = doc.GetRowFromElement (el);\r
-                       AssertNotNull (row);\r
-                       AssertEquals (DataRowState.Added, row.RowState);\r
+                       Assert.IsNotNull (row);\r
+                       Assert.AreEqual (DataRowState.Added, row.RowState);\r
 \r
                        // col1 - it is column. no mapped row\r
                        el = el.FirstChild as XmlElement;\r
                        row = doc.GetRowFromElement (el);\r
-                       AssertNull (row);\r
+                       Assert.IsNull (row);\r
 \r
                        // col2 - it is column. np mapped row\r
                        el = el.NextSibling as XmlElement;\r
                        row = doc.GetRowFromElement (el);\r
-                       AssertNull (row);\r
+                       Assert.IsNull (row);\r
 \r
                        // child - has mapped row\r
                        el = el.NextSibling as XmlElement;\r
                        row = doc.GetRowFromElement (el);\r
-                       AssertNotNull (row);\r
-                       AssertEquals (DataRowState.Added, row.RowState);\r
+                       Assert.IsNotNull (row);\r
+                       Assert.AreEqual (DataRowState.Added, row.RowState);\r
 \r
                        // created (detached) table 1 element (used later)\r
                        el = doc.CreateElement ("tab1");\r
                        row = doc.GetRowFromElement (el);\r
-                       AssertEquals (DataRowState.Detached, row.RowState);\r
-                       AssertEquals (1, dt.Rows.Count); // not added yet\r
+                       Assert.AreEqual (DataRowState.Detached, row.RowState);\r
+                       Assert.AreEqual (1, dt.Rows.Count); // not added yet\r
 \r
                        // adding a node before setting EnforceConstraints\r
                        // raises an error\r
                        try {\r
                                doc.DocumentElement.AppendChild (el);\r
-                               Fail ("Invalid Operation should occur; EnforceConstraints prevents addition.");\r
+                               Assert.Fail ("Invalid Operation should occur; EnforceConstraints prevents addition.");\r
                        } catch (InvalidOperationException) {\r
                        }\r
 \r
                        // try again...\r
                        ds.EnforceConstraints = false;\r
-                       AssertEquals (1, dt.Rows.Count); // not added yet\r
+                       Assert.AreEqual (1, dt.Rows.Count); // not added yet\r
                        doc.DocumentElement.AppendChild (el);\r
-                       AssertEquals (2, dt.Rows.Count); // added\r
+                       Assert.AreEqual (2, dt.Rows.Count); // added\r
                        row = doc.GetRowFromElement (el);\r
-                       AssertEquals (DataRowState.Added, row.RowState); // changed\r
+                       Assert.AreEqual (DataRowState.Added, row.RowState); // changed\r
 \r
                        // Irrelevant element\r
                        XmlElement el2 = doc.CreateElement ("hoge");\r
                        row = doc.GetRowFromElement (el2);\r
-                       AssertNull (row);\r
+                       Assert.IsNull (row);\r
 \r
                        // created table 2 element (used later)\r
                        el = doc.CreateElement ("child");\r
                        row = doc.GetRowFromElement (el);\r
-                       AssertEquals (DataRowState.Detached, row.RowState);\r
+                       Assert.AreEqual (DataRowState.Detached, row.RowState);\r
 \r
                        // Adding it to irrelevant element performs no row state change.\r
-                       AssertEquals (1, dt2.Rows.Count); // not added yet\r
+                       Assert.AreEqual (1, dt2.Rows.Count); // not added yet\r
                        el2.AppendChild (el);\r
-                       AssertEquals (1, dt2.Rows.Count); // still not added\r
+                       Assert.AreEqual (1, dt2.Rows.Count); // still not added\r
                        row = doc.GetRowFromElement (el);\r
-                       AssertEquals (DataRowState.Detached, row.RowState); // still detached here\r
+                       Assert.AreEqual (DataRowState.Detached, row.RowState); // still detached here\r
                }\r
 
                // bug #54505
@@ -244,8 +244,8 @@ namespace MonoTests.System.Xml
                        StringReader sr = new StringReader (sw.ToString());
                        doc1.Load (sr);
 
-                       AssertEquals ("#1", 1, ds1.Tables [0].Rows.Count);
-                       AssertEquals ("#2", 1, ds1.Tables [0].Rows [0][0]);
+                       Assert.AreEqual (1, ds1.Tables [0].Rows.Count, "#1");
+                       Assert.AreEqual (1, ds1.Tables [0].Rows [0][0], "#2");
                }
 
                [Test]
@@ -267,8 +267,8 @@ namespace MonoTests.System.Xml
                        StringReader sr = new StringReader (sw.ToString());
                        doc1.Load (sr);
 
-                       AssertEquals ("#1", 1, ds1.Tables [0].Rows [0][0]);
-                       AssertEquals ("#2", true, ds1.Tables [0].Rows [0].IsNull (1));
+                       Assert.AreEqual (1, ds1.Tables [0].Rows [0][0], "#1");
+                       Assert.AreEqual (true, ds1.Tables [0].Rows [0].IsNull (1), "#2");
                }
 
                [Test]
@@ -301,9 +301,9 @@ namespace MonoTests.System.Xml
                        StringReader sreader = new StringReader (swriter.ToString ());
                        DataSet ds1 = ds.Clone ();
                        XmlDataDocument doc1 = new XmlDataDocument (ds1);
-                       AssertEquals ("#2" , 0, ds1.Tables [0].Rows.Count);
+                       Assert.AreEqual (0 , ds1.Tables [0].Rows.Count, "#2");
                        doc1.Load (sreader);
-                       AssertEquals ("#3" , 3, ds1.Tables [0].Rows.Count);
+                       Assert.AreEqual (3 , ds1.Tables [0].Rows.Count, "#3");
                }
        }
 }
index 2b9a54d7fdc0000eddd99e1658c42c983ed26a63..6daf9e10a279d7ea4e3092d07dbb97036b3ba1ed 100644 (file)
@@ -100,7 +100,7 @@ namespace System.Net.Http
 
                public CookieContainer CookieContainer {
                        get {
-                               return cookies;
+                               return cookies ?? (cookies = new CookieContainer ());
                        }
                        set {
                                EnsureModifiability ();
index cbab4c217e351dd889fb43deb4e38ddaf89e334c..86b4617162fc6748ee66e72bc260d87eb70c45d4 100644 (file)
@@ -53,7 +53,7 @@ namespace SoapShared
                        Serialize(obj, ms);\r
                        ms.Position = 0;\r
                        Object des = Deserialize(ms);\r
-                       Assertion.AssertEquals(obj.GetType(), des.GetType());\r
+                       Assert.AreEqual (obj.GetType(), des.GetType());\r
                }\r
 \r
                private void Serialize(object ob, Stream stream)\r
index d3914d9b327e196bbcb49272f85209a824af0798..3aee88df4a84300bb5aa06789fee44bc0d07f56d 100644 (file)
@@ -222,7 +222,7 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Soap
                        if (expected != null && expected.GetType().IsArray)\r
                                EqualsArray (message, (Array)expected, (Array)actual);\r
                        else\r
-                               Assertion.AssertEquals (message, expected, actual);\r
+                               Assert.AreEqual (expected, actual, message);\r\r
                }\r
 \r
                public static void EqualsArray (string message, object oar1, object oar2)\r
index 9735ce04b04384613adcd857558bf1c0e3010d9e..91fdd7857d861780fc152c39bed8dd11247859a7 100644 (file)
@@ -171,8 +171,8 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Soap {
                \r
                private object Serialize(object objGraph) {\r
                        MemoryStream stream = new MemoryStream();\r
-                       Assertion.Assert(objGraph != null);\r
-                       Assertion.Assert(stream != null);\r
+                       Assert.IsTrue(objGraph != null);\r
+                       Assert.IsTrue(stream != null);\r
                        _soapFormatter.SurrogateSelector = _surrogate;\r
                        _soapFormatter.Serialize(stream, objGraph);\r
                        \r
@@ -182,8 +182,8 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Soap {
                        stream.Position = 0;\r
                        \r
                        object objReturn = _soapFormatterDeserializer.Deserialize(stream);\r
-                       Assertion.Assert(objReturn != null);\r
-                       Assertion.AssertEquals("#Tests "+objGraph.GetType(), objGraph.GetType(), objReturn.GetType());\r
+                       Assert.IsTrue(objReturn != null);\r
+                       Assert.AreEqual(objGraph.GetType(), objReturn.GetType(), "#Tests "+objGraph.GetType());\r
                        stream = new MemoryStream();\r
                        _soapFormatter.Serialize(stream, objReturn);\r
                        stream.Position = 0;\r
@@ -209,19 +209,19 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Soap {
                public void TestValueTypes() {\r
                        object objReturn;\r
                        objReturn = Serialize((short)1);\r
-                       Assertion.AssertEquals("#int16", objReturn, 1);\r
+                       Assert.AreEqual(objReturn, 1, "#int16");\r
                        objReturn = Serialize(1);\r
-                       Assertion.AssertEquals("#int32", objReturn, 1);\r
+                       Assert.AreEqual(objReturn, 1, "#int32");\r
                        objReturn = Serialize((Single)0.1234);\r
-                       Assertion.AssertEquals("#Single", objReturn, 0.123400003f);\r
+                       Assert.AreEqual(objReturn, 0.123400003f, "#Single");\r
                        objReturn = Serialize((Double)1234567890.0987654321);\r
-                       Assertion.AssertEquals("#iDouble", objReturn, 1234567890.0987654321);\r
+                       Assert.AreEqual(objReturn, 1234567890.0987654321, "#iDouble");\r
                        objReturn = Serialize(true);\r
-                       Assertion.AssertEquals("#Bool", objReturn, true);\r
+                       Assert.AreEqual(objReturn, true, "#Bool");\r
                        objReturn = Serialize((Int64) 1234567890);\r
-                       Assertion.AssertEquals("#Int64", objReturn, 1234567890);\r
+                       Assert.AreEqual(objReturn, 1234567890, "#Int64");\r
                        objReturn = Serialize('c');\r
-                       Assertion.AssertEquals("#Char", objReturn, 'c');\r
+                       Assert.AreEqual(objReturn, 'c', "#Char");\r
                }\r
                \r
                [Test]\r
@@ -229,7 +229,7 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Soap {
                        object objReturn;\r
                        objReturn = Serialize("");\r
                        objReturn = Serialize("hello world!");\r
-                       Assertion.AssertEquals("#string", "hello world!", objReturn);\r
+                       Assert.AreEqual("hello world!", objReturn, "#string");\r
                        SoapMessage soapMsg = new SoapMessage();\r
                        soapMsg.Headers = new Header[0];\r
                        soapMsg.MethodName = "Equals";\r
@@ -242,27 +242,27 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Soap {
                        _soapFormatterDeserializer.TopObject = null;\r
                        SimpleObject obj = new SimpleObject("simple object", 1);\r
                        objReturn = Serialize(obj);\r
-                       Assertion.AssertEquals("#SimpleObject", obj, objReturn);\r
+                       Assert.AreEqual(obj, objReturn, "#SimpleObject");\r
                        objReturn = Serialize(typeof(SimpleObject));\r
-                       Assertion.AssertEquals("#Type", typeof(SimpleObject), (Type)objReturn);\r
+                       Assert.AreEqual(typeof(SimpleObject), (Type)objReturn, "#Type");\r
                        objReturn = Serialize(obj.GetType().Assembly);\r
-                       Assertion.AssertEquals("#Assembly", obj.GetType().Assembly, objReturn);\r
+                       Assert.AreEqual(obj.GetType().Assembly, objReturn, "#Assembly");\r
                }\r
                \r
                public static bool CheckArray(object objTest, object objReturn) {\r
                        Array objTestAsArray = objTest as Array;\r
                        Array objReturnAsArray = objReturn as Array;\r
                        \r
-                       Assertion.Assert("#Not an Array "+objTest, objReturnAsArray != null);\r
-                       Assertion.AssertEquals("#Different lengths "+objTest, objTestAsArray.Length, objReturnAsArray.Length);\r
-                       \r
+                       Assert.IsTrue(objReturnAsArray != null, "#Not an Array "+objTest);\r
+                       Assert.AreEqual(objTestAsArray.Length, objReturnAsArray.Length, "#Different lengths "+objTest);\r
+                       
                        IEnumerator iEnum = objReturnAsArray.GetEnumerator();\r
                        iEnum.Reset();\r
                        object obj2;\r
                        foreach(object obj1 in objTestAsArray) {\r
                                iEnum.MoveNext();\r
                                obj2 = iEnum.Current;\r
-                               Assertion.AssertEquals("#The content of the 2 arrays is different", obj1, obj2);\r
+                               Assert.AreEqual(obj1, obj2, "#The content of the 2 arrays is different");\r
                        }\r
                        \r
                        return true;\r
@@ -315,9 +315,9 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Soap {
                        MoreComplexObject objReturn;\r
                        MoreComplexObject objTest = new MoreComplexObject();\r
                        objReturn = (MoreComplexObject) Serialize(objTest);\r
-                       Assertion.AssertEquals("#Equals", objTest, objReturn);\r
+                       Assert.AreEqual(objTest, objReturn, "#Equals");\r
                        objReturn.OnTrucEvent("bidule");\r
-                       Assertion.AssertEquals("#dlg", "bidule", objReturn.ObjString);\r
+                       Assert.AreEqual("bidule", objReturn.ObjString, "#dlg");\r
                }\r
 \r
                [Test]\r
@@ -333,9 +333,9 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Soap {
                        _soapFormatterDeserializer.Binder = new Version1ToVersion2Binder();\r
                        objReturn = _soapFormatterDeserializer.Deserialize(stream);\r
 \r
-                       Assertion.AssertEquals("#Version1 Version2", "Version2", objReturn.GetType().Name);\r
-                       Assertion.AssertEquals("#_value", 123, ((Version2) objReturn)._value);\r
-                       Assertion.AssertEquals("#_foo", "Default value", ((Version2) objReturn)._foo);\r
+                       Assert.AreEqual("Version2", objReturn.GetType().Name, "#Version1 Version2");\r
+                       Assert.AreEqual(123, ((Version2) objReturn)._value, "#_value");\r
+                       Assert.AreEqual("Default value", ((Version2) objReturn)._foo, "#_foo");\r
                }\r
                \r
                [Test]\r
@@ -360,17 +360,17 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Soap {
                        sf.TopObject = t;\r
                        t = (SoapMessage) sf.Deserialize (ms);\r
                        \r
-                       Assertion.AssertNotNull ("#1", t.Headers[0].Value);\r
-                       Assertion.AssertEquals ("#2", t.Headers[0].Value.GetType (), typeof(Type[]));\r
+                       Assert.IsNotNull (t.Headers[0].Value, "#1");\r
+                       Assert.AreEqual (t.Headers[0].Value.GetType (), typeof(Type[]), "#2");\r
                        \r
                        Type[] ts = (Type[]) t.Headers[0].Value;\r
                        \r
-                       Assertion.AssertEquals ("#3", 2, ts.Length);\r
-                       Assertion.AssertNotNull ("#4", ts[0]);\r
-                       Assertion.AssertNotNull ("#5", ts[1]);\r
+                       Assert.AreEqual (2, ts.Length, "#3");\r
+                       Assert.IsNotNull (ts[0], "#4");\r
+                       Assert.IsNotNull (ts[1], "#5");\r
                        Console.WriteLine ("PPP:" + ts[0].GetType());\r
-                       Assertion.AssertEquals ("#6", typeof(string), ts[0]);\r
-                       Assertion.AssertEquals ("#7", typeof(SignatureTest[]), ts[1]);\r
+                       Assert.AreEqual (typeof(string), ts[0], "#6");\r
+                       Assert.AreEqual (typeof(SignatureTest[]), ts[1], "#7");\r
                }\r
 \r
                [Test]\r
@@ -398,14 +398,14 @@ namespace MonoTests.System.Runtime.Serialization.Formatters.Soap {
                        public void OnDeserialization (StreamingContext context)\r
                        {\r
                                var ci = Thread.CurrentThread.CurrentCulture;\r
-                               Assertion.AssertEquals("#1", "German (Germany)", ci.EnglishName);\r
+                               Assert.AreEqual("German (Germany)", ci.EnglishName, "#1");\r
                        }\r
                        \r
                        [OnSerialized]\r
                        public void OnSerialized (StreamingContext context)\r
                        {\r
                                var ci = Thread.CurrentThread.CurrentCulture;\r
-                               Assertion.AssertEquals("#2", "German (Germany)", ci.EnglishName);\r
+                               Assert.AreEqual("German (Germany)", ci.EnglishName, "#2");\r
                        }\r
                }\r
        }\r
index 776751537bdae8df69c5134c20ade5c097c65eb5..f8a83bb6f3b45132e5066093813545f62f9055bb 100644 (file)
@@ -222,7 +222,7 @@ namespace Mono.Net.Security.Private
                }
 
                public int KeyExchangeStrength {
-                       get { return KeyExchangeStrength; }
+                       get { return Impl.KeyExchangeStrength; }
                }
 
                public bool CanRead {
index cb8b01de36f644f5b2c2ed5fe135b43c6d43f4bb..c7576897189c0e6c30b155b2380569a1867cc119 100644 (file)
@@ -3176,7 +3176,7 @@ namespace System.Net.Sockets
                {
                        ThrowIfDisposedAndClosed ();
 
-                       if (optionName == SocketOptionName.ReuseAddress && optionValue != 0 && !SupportsPortReuse ())
+                       if (optionLevel == SocketOptionLevel.Socket && optionName == SocketOptionName.ReuseAddress && optionValue != 0 && !SupportsPortReuse (protocol_type))
                                throw new SocketException ((int) SocketError.OperationNotSupported, "Operating system sockets do not support ReuseAddress.\nIf your socket is not intended to bind to the same address and port multiple times remove this option, otherwise you should ignore this exception inside a try catch and check that ReuseAddress is true before binding to the same address and port multiple times.");
 
                        int error;
@@ -3479,7 +3479,7 @@ namespace System.Net.Sockets
                internal static extern void cancel_blocking_socket_operation (Thread thread);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               internal static extern bool SupportsPortReuse ();
+               internal static extern bool SupportsPortReuse (ProtocolType proto);
        }
 }
 
index dbc4110cb20c65a6822e4568331fc90b36091cd7..ec9d6b1bb0a4acadf905e1c9e8135ce34aa5f8ed 100644 (file)
@@ -190,7 +190,7 @@ namespace MonoTests.System.ComponentModel.Design.Serialization {
                {
 #if MOBILE
                        // ensure the property is not linked out of the application since it make the test fails
-                       Assert.NotNull (Thread.CurrentPrincipal, "pre-test");
+                       Assert.IsNotNull (Thread.CurrentPrincipal, "pre-test");
 #endif
                        PropertyInfo pi = typeof (Thread).GetProperty ("CurrentPrincipal");
 
@@ -213,7 +213,7 @@ namespace MonoTests.System.ComponentModel.Design.Serialization {
                {
 #if MOBILE
                        // ensure the property is not linked out of the application since it make the test fails
-                       Assert.NotNull (Thread.CurrentPrincipal, "pre-test");
+                       Assert.IsNotNull (Thread.CurrentPrincipal, "pre-test");
 #endif
                        PropertyInfo pi = typeof (Thread).GetProperty ("CurrentPrincipal");
 
index f137139a55f6f110dedb325a862eba722d69572b..d59d39fad89d232798a341ce06bdd238b3da044f 100644 (file)
@@ -106,11 +106,11 @@ namespace MonoTests.System.Net.Sockets
                        bool res = clientSocket.SendAsync (e);
                        if (res) {
                                if (!m.WaitOne (1500))
-                                       throw new TimeoutException ();
+                                       Assert.Fail ("Timeout #1");
                        }
 
                        if (!mainEvent.WaitOne (1500))
-                               throw new TimeoutException ();
+                               Assert.Fail ("Timeout #2");
                        if (error != null)
                                throw error;
 
@@ -124,13 +124,13 @@ namespace MonoTests.System.Net.Sockets
                        res = clientSocket.SendAsync (e);
                        if (res) {
                                if (!m.WaitOne (1500))
-                                       throw new TimeoutException ();
+                                       Assert.Fail ("Timeout #3");
                        }
 
                        if (!mainEvent.WaitOne (1500))
-                               throw new TimeoutException ();
+                               Assert.Fail ("Timeout #4");
                        if (error != null)
                                throw error;
                }
        }
-}
\ No newline at end of file
+}
index 77fb73e3f00ed1404dbe81fe1a68294f5d7068a2..3afff1226ae85d5d8207c551ca5a2dac459f6cec 100644 (file)
@@ -154,7 +154,7 @@ namespace MonoTests.System.Net {
                        Send (ns, "GET / HTTP/1.1\r\n\r\n"); // No host
                        string response = Receive (ns, 512);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 400", response);
+                       Assert.IsTrue(response.StartsWith ("HTTP/1.1 400"));
                }
 
                [Test]
@@ -166,7 +166,7 @@ namespace MonoTests.System.Net {
                        Send (ns, "GET / HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n"); // no prefix
                        string response = Receive (ns, 512);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 400", response);
+                       Assert.IsTrue(response.StartsWith ("HTTP/1.1 400"));
                }
 
                [Test]
@@ -204,7 +204,7 @@ namespace MonoTests.System.Net {
                                string response = Receive (ns, 512);
                                ns.Close ();
                                listener.Close ();
-                               StringAssert.StartsWith ("HTTP/1.1 400", response, String.Format ("Failed on {0}", (int) b));
+                               Assert.IsTrue(response.StartsWith ("HTTP/1.1 400"), String.Format ("Failed on {0}", (int) b));
                        }
                }
 
@@ -217,7 +217,7 @@ namespace MonoTests.System.Net {
                        Send (ns, "POST /test4/ HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n"); // length required
                        string response = Receive (ns, 512);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 411", response);
+                       Assert.IsTrue(response.StartsWith ("HTTP/1.1 411"));
                }
 
                [Test]
@@ -229,7 +229,7 @@ namespace MonoTests.System.Net {
                        Send (ns, "POST / HTTP/1.1\r\nHost: 127.0.0.1\r\nTransfer-Encoding: pepe\r\n\r\n"); // not implemented
                        string response = Receive (ns, 512);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 501", response);
+                       Assert.IsTrue(response.StartsWith ("HTTP/1.1 501"));
                }
 
                [Test]
@@ -242,7 +242,7 @@ namespace MonoTests.System.Net {
                        Send (ns, "POST /test6/ HTTP/1.1\r\nHost: 127.0.0.1\r\nTransfer-Encoding: identity\r\n\r\n");
                        string response = Receive (ns, 512);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 501", response);
+                       Assert.IsTrue(response.StartsWith ("HTTP/1.1 501"));
                }
 
                [Test]
@@ -257,8 +257,8 @@ namespace MonoTests.System.Net {
                        ctx.Response.Close ();
                        string response = Receive (ns, 1024);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 200", response);
-                       StringAssert.Contains ("Transfer-Encoding: chunked", response);
+                       Assert.IsTrue(response.StartsWith ("HTTP/1.1 200"));
+                       Assert.IsTrue(response.Contains ("Transfer-Encoding: chunked"));
                }
 
                [Test]
@@ -274,7 +274,7 @@ namespace MonoTests.System.Net {
                        ctx.Response.Close ();
                        string response = Receive (ns, 512);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 200", response);
+                       Assert.IsTrue(response.StartsWith ("HTTP/1.1 200"));
                        Assert.IsTrue (-1 == response.IndexOf ("Transfer-Encoding: chunked"));
                }
 
@@ -290,7 +290,7 @@ namespace MonoTests.System.Net {
                        string response = ReceiveWithTimeout (ns, 512, 1000, out timeout);
                        ns.Close ();
                        Assert.IsFalse (timeout);
-                       StringAssert.StartsWith ("HTTP/1.1 411", response);
+                       Assert.IsTrue(response.StartsWith ("HTTP/1.1 411"));
                }
 
                [Test]
@@ -306,7 +306,7 @@ namespace MonoTests.System.Net {
                        string response = ReceiveWithTimeout (ns, 512, 1000, out timeout);
                        ns.Close ();
                        Assert.IsFalse (timeout);
-                       StringAssert.StartsWith ("HTTP/1.1 411", response);
+                       Assert.IsTrue(response.StartsWith ("HTTP/1.1 411"));
                }
 
                [Test]
@@ -320,7 +320,7 @@ namespace MonoTests.System.Net {
                        ns.GetSocket ().Shutdown (SocketShutdown.Send);
                        string input = Receive (ns, 512);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 400", input);
+                       Assert.IsTrue(input.StartsWith ("HTTP/1.1 400"));
                }
 
                [Test]
@@ -334,7 +334,7 @@ namespace MonoTests.System.Net {
                        ns.GetSocket ().Shutdown (SocketShutdown.Send);
                        string input = Receive (ns, 512);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 400", input);
+                       Assert.IsTrue(input.StartsWith ("HTTP/1.1 400"));
                }
 
                [Test]
@@ -348,7 +348,7 @@ namespace MonoTests.System.Net {
                        ns.GetSocket ().Shutdown (SocketShutdown.Send);
                        string input = Receive (ns, 512);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 400", input);
+                       Assert.IsTrue(input.StartsWith ("HTTP/1.1 400"));
                }
 
                HttpListenerRequest test14_request;
@@ -448,8 +448,8 @@ namespace MonoTests.System.Net {
                        ctx.Response.Close ();
                        string response = Receive (ns, 1024);
                        ns.Close ();
-                       StringAssert.StartsWith ("HTTP/1.1 200", response);
-                       StringAssert.Contains ("Transfer-Encoding: chunked", response);
+                       Assert.IsTrue(response.StartsWith ("HTTP/1.1 200"));
+                       Assert.IsTrue(response.Contains ("Transfer-Encoding: chunked"));
                }
 
                [Test]
index c088e4e14e2ddeb71509bbda356c4d7761d12c66..6ff1b33260ed2ab7e82883d4f600a12e89136888 100644 (file)
@@ -30,6 +30,7 @@
 using System;
 using System.IO;
 using System.Net;
+using System.Net.NetworkInformation;
 using System.Net.Sockets;
 using System.Text;
 using System.Collections.Generic;
@@ -194,15 +195,22 @@ namespace MonoTests.System.Net
                [Test]
                public void HttpRequestIsLocal ()
                {
-                       var ips = new List<IPAddress> (Dns.GetHostAddresses (Dns.GetHostName ()));
+                       var port = NetworkHelpers.FindFreePort ();
+                       var ips = new List<IPAddress> ();
                        ips.Add (IPAddress.Loopback);
+                       foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces ()) {
+                               foreach (var ip in adapter.GetIPProperties ().UnicastAddresses) {
+                                       ips.Add (ip.Address);
+                               }
+                       }
+
                        foreach (var ip in ips) {
                                if (ip.AddressFamily != AddressFamily.InterNetwork)
                                        continue;
 
                                HttpListener listener = HttpListener2Test.CreateAndStartListener (
-                                       "http://" + ip + ":9000/HttpRequestIsLocal/");
-                               NetworkStream ns = HttpListener2Test.CreateNS (ip, 9000);
+                                       "http://" + ip + ":" + port + "/HttpRequestIsLocal/");
+                               NetworkStream ns = HttpListener2Test.CreateNS (ip, port);
                                HttpListener2Test.Send (ns, "GET /HttpRequestIsLocal/ HTTP/1.0\r\n\r\n");
                                HttpListenerContext ctx = listener.GetContext ();
                                HttpListenerRequest request = ctx.Request;
index 63a6b3e52b3e2ffd2c27acab0f8c8e547e035ddc..346f35bdeacd358202f49bad9a130cef91bd0066 100644 (file)
@@ -219,7 +219,7 @@ public class ServicePointTest
 
                ServicePointManager.DnsRefreshTimeout = dnsRefreshTimeout;
 
-               uri = new Uri ("http://www.google.com/");
+               uri = new Uri ("http://localhost/");
                sp = ServicePointManager.FindServicePoint (uri);
 
                hostEntryProperty = typeof (ServicePoint).GetProperty ("HostEntry", BindingFlags.NonPublic | BindingFlags.Instance);
index efc9027e19c0f7cefd75374bf765809f990b3b06..9f5b848af0cb21d9e4af05662fceaa4c10b85a08 100644 (file)
@@ -2064,5 +2064,13 @@ namespace MonoTests.System
 
                        Assert.AreEqual ("http://localhost/foo", res.ToString ());
                }
+
+               [Test]
+               public void ImplicitUnixFileWithUnicode ()
+               {
+                       string value = "/Library/Frameworks/System.Runtim…ee";
+                       Uri uri;
+                       Assert.IsTrue (Uri.TryCreate (value, UriKind.Absolute, out uri));
+               }
        }
 }
index 3b324d1eab7076389642e0a1776b0343f9366ada..ef0b895922c7f91a49102e533202f082c2472962 100644 (file)
@@ -68,8 +68,38 @@ namespace System.Runtime.Remoting.Messaging {
                internal static String CallContextKey = "__CallContext";
                internal static String UriKey           = "__Uri";
 
-               [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               internal extern void InitMessage (MonoMethod method, object [] out_args);
+               internal void InitMessage (MonoMethod method, object [] out_args)
+               {
+                       this.method = method;
+                       ParameterInfo[] paramInfo = method.GetParametersInternal ();
+                       int param_count = paramInfo.Length;
+                       args = new object[param_count];
+                       arg_types = new byte[param_count];
+                       asyncResult = null;
+                       call_type = CallType.Sync;
+                       names = new string[param_count];
+                       for (int i = 0; i < param_count; i++) {
+                               names[i] = paramInfo[i].Name;
+                       }
+                       bool hasOutArgs = out_args != null;
+                       int j = 0;
+                       for (int i = 0; i < param_count; i++) {
+                               byte arg_type;
+                               bool isOut = paramInfo[i].IsOut;
+                               if (paramInfo[i].ParameterType.IsByRef) {
+                                       if (hasOutArgs)
+                                               args[i] = out_args[j++];
+                                       arg_type = 2; // OUT
+                                       if (!isOut)
+                                               arg_type |= 1; // INOUT
+                               } else {
+                                       arg_type = 1; // IN
+                                       if (isOut)
+                                               arg_type |= 4; // IN, COPY OUT
+                               }
+                               arg_types[i] = arg_type;
+                       }
+               }
 
                public MonoMethodMessage (MethodBase method, object [] out_args)
                {
index fd5e734534ef56ad965b2fc8621ab86df4206507..dcfe35c85fc8899c4bf94d62686b272cfce0e50c 100644 (file)
@@ -57,7 +57,7 @@ namespace System {
                 * of icalls, do not require an increment.
                 */
 #pragma warning disable 169
-               private const int mono_corlib_version = 149;
+               private const int mono_corlib_version = 150;
 #pragma warning restore 169
 
                [ComVisible (true)]
index 466678053574bb701b9ca5cc44b4b37b0eb4d7b1..d03405487df0b4d8c199267212373e81b8a8d56c 100644 (file)
@@ -1221,8 +1221,10 @@ namespace System
 
                        try {
                                return ParseTZBuffer (id, buffer, length);
+                       } catch (InvalidTimeZoneException) {
+                               throw;
                        } catch (Exception e) {
-                               throw new InvalidTimeZoneException (e.Message);
+                               throw new InvalidTimeZoneException ("Time zone information file contains invalid data", e);
                        }
                }
 
@@ -1279,7 +1281,7 @@ namespace System
                        if (time_types.Count == 0)
                                throw new InvalidTimeZoneException ();
 
-                       if (time_types.Count == 1 && ((TimeType)time_types[0]).IsDst)
+                       if (time_types.Count == 1 && time_types[0].IsDst)
                                throw new InvalidTimeZoneException ();
 
                        TimeSpan baseUtcOffset = new TimeSpan (0);
@@ -1360,8 +1362,8 @@ namespace System
 
                        TimeZoneInfo tz;
                        if (adjustmentRules.Count == 0 && !storeTransition) {
-                               TimeType t = (TimeType)time_types [0];
                                if (standardDisplayName == null) {
+                                       var t = time_types [0];
                                        standardDisplayName = t.Name;
                                        baseUtcOffset = new TimeSpan (0, 0, t.Offset);
                                }
@@ -1405,6 +1407,20 @@ namespace System
                        var types = new Dictionary<int, TimeType> (count);
                        for (int i = 0; i < count; i++) {
                                int offset = ReadBigEndianInt32 (buffer, index + 6 * i);
+
+                               //
+                               // The official tz database contains timezone with GMT offsets
+                               // not only in whole hours/minutes but in seconds. This happens for years
+                               // before 1901. For example
+                               //
+                               // NAME                 GMTOFF   RULES  FORMAT  UNTIL
+                               // Europe/Madrid        -0:14:44 -      LMT     1901 Jan  1  0:00s
+                               //
+                               // .NET as of 4.6.2 cannot handle that and uses hours/minutes only, so
+                               // we remove seconds to not crash later
+                               //
+                               offset = (offset / 60) * 60;
+
                                byte is_dst = buffer [index + 6 * i + 4];
                                byte abbrev = buffer [index + 6 * i + 5];
                                types.Add (i, new TimeType (offset, (is_dst != 0), abbreviations [(int)abbrev]));
@@ -1460,7 +1476,7 @@ namespace System
 #endregion
        }
 
-       struct TimeType {
+       class TimeType {
                public readonly int Offset;
                public readonly bool IsDst;
                public string Name;
index 94ff296ced511a8752575675a1f99ad0b4eed515..007c0a44d9d314420699358453e1537b89c61e9c 100644 (file)
@@ -179,48 +179,48 @@ namespace MonoTests.Mono.Math.Arithmetic.Big {
                [Test]
                public void AgtB () 
                {
-                       Assertion.Assert(A > B);
+                       Assert.IsTrue(A > B);
                }
                
                [Test]
                public void ANotLtB () 
                {
-                       Assertion.Assert(!(A < B));
+                       Assert.IsTrue(!(A < B));
                }
                
                [Test]
                public void BNotGtA () 
                {
-                       Assertion.Assert(!(B > A));
+                       Assert.IsTrue(!(B > A));
                }
                
                [Test]
                public void AltB () 
                {
-                       Assertion.Assert(B < A);
+                       Assert.IsTrue(B < A);
                }
                
                [Test]
                public void AeqA () 
                {
-                       Assertion.Assert(A == A);
+                       Assert.IsTrue(A == A);
                }
                [Test]
                public void BeqB () 
                {
-                       Assertion.Assert(B == B);
+                       Assert.IsTrue(B == B);
                }
                
                [Test]
                public void AneqB () 
                {
-                       Assertion.Assert(A != B);
+                       Assert.IsTrue(A != B);
                }
                
                [Test]
                public void BneqA () 
                {
-                       Assertion.Assert(B != A);
+                       Assert.IsTrue(B != A);
                }
 
                #endregion
index e6ddb0fc36ea2431ba66db0be801552f2dc38893..b1ba0d26e6eccdaad8a3a6bb71161dd321269d37 100644 (file)
@@ -81,12 +81,12 @@ namespace MonoTests.Mono.Math {
 
                private void ExpectComposite (BigInteger bi)
                {
-                       Assertion.AssertEquals (false, bi.isProbablePrime ());
+                       Assert.AreEqual (false, bi.isProbablePrime ());
                }
 
                private void ExpectPrime (BigInteger bi)
                {
-                       Assertion.AssertEquals (true, bi.isProbablePrime ());
+                       Assert.AreEqual (true, bi.isProbablePrime ());
                }
        }
 
index 4b4b3b3a805435ed9d707ba690ad2a6f0df0137a..ce4f22174b18ed9442e60785e48be5e91b72d01a 100644 (file)
@@ -770,7 +770,7 @@ namespace MonoTests.System.Collections
                        for (int i = 0; i < 20; i++)
                                sl1.RemoveAt (9);
 
-                       Assert.AreEqual (30, sl1.Count, 30, "#C1");
+                       Assert.AreEqual (30, (double) sl1.Count, 30, "#C1");
                        for (int i = 0; i < 9; i++)
                                Assert.AreEqual (i, sl1 ["kala " + string.Format ("{0:D2}", i)], "#C2:" + i);
                        for (int i = 9; i < 29; i++)
index b43d9fd08954b011f170b3629bf0fe147a876a91..bc3416441cfad03b93e428301df40573aaff264e 100644 (file)
@@ -182,7 +182,10 @@ namespace MonoTests.System.Reflection
                        // note: only available in default appdomain
                        // http://weblogs.asp.net/asanto/archive/2003/09/08/26710.aspx
                        // Not sure we should emulate this behavior.
-#if !MONODROID
+#if __WATCHOS__
+                       Assert.IsNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
+                       Assert.IsTrue (AppDomain.CurrentDomain.IsDefaultAppDomain (), "!default appdomain");
+#elif !MONODROID
                        string fname = AppDomain.CurrentDomain.FriendlyName;
                        if (fname.EndsWith (".dll")) { // nunit-console
                                Assert.IsNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
@@ -249,7 +252,7 @@ namespace MonoTests.System.Reflection
                public void Corlib_test ()
                {
                        Assembly corlib_test = Assembly.GetExecutingAssembly ();
-#if MONODROID || MOBILE_STATIC
+#if MONODROID || MOBILE_STATIC || __WATCHOS__
                        Assert.IsNull (corlib_test.EntryPoint, "EntryPoint");
                        Assert.IsNull (corlib_test.Evidence, "Evidence");
 #elif MOBILE
index 2124aa85733b05943c15d6c00f8c006ed856713e..2391dbb65071a4f0a313703b9e3aac16d322de59 100644 (file)
@@ -1876,7 +1876,7 @@ namespace MonoTests.System {
                                iTest++;
                                Assert.AreEqual ((float)0, Convert.ToSingle(tryByte), "#N03");
                                iTest++;
-                               Assert.AreEqual ((float)1234, 234, Convert.ToSingle(tryDec), "#N04");
+                               Assert.AreEqual ((float)1234, (double)234, Convert.ToSingle(tryDec), "#N04");
                                iTest++;
                                Assert.AreEqual ((float)0, Convert.ToSingle(tryDbl), "#N05");
                                iTest++;
@@ -1888,7 +1888,7 @@ namespace MonoTests.System {
                                iTest++;
                                Assert.AreEqual ((float)123, Convert.ToSingle(trySByte), "#N09");
                                iTest++;
-                               Assert.AreEqual ((float)1234, 2345, Convert.ToSingle(tryFloat), "#N10");
+                               Assert.AreEqual ((float)1234, (double)2345, Convert.ToSingle(tryFloat), "#N10");
                                iTest++;
                                Assert.AreEqual ((float)987, Convert.ToSingle("987"), "#N11");
                                iTest++;
index deb0e3314b650593fd20d1b2c71e5f0a84200468..fed370974e584b8d5c33dd49eca0a75dc87de8e6 100644 (file)
@@ -156,9 +156,13 @@ namespace MonoTests.System
                public void GetCommandLineArgs ()
                {
                        string[] args = Environment.GetCommandLineArgs ();
+#if !__WATCHOS__
                        Assert.IsNotNull (args, "not null");
                        Assert.IsTrue (((args.Length > 0) && (args.Length < 256)), "reasonable");
                        Assert.IsNotNull (args [0], "application");
+#else
+                       Assert.AreEqual (0, args.Length, "length");
+#endif
                }
 
 #if !NET_2_1
index d18f8a4efefc646ddad2bf07a71c2817d17b491b..99a1f66a1f3fcb933e3ef2d1bec6f7da42d39370 100644 (file)
@@ -923,18 +923,18 @@ namespace MonoTests.System
                                        "Canada/Newfoundland",
                                        "Europe/Moscow",
                                        "Europe/Riga",
-                                       "N/A", // testing that the test doesn't fail with inexistent TZs
                                };
                                foreach (var tz in subMinuteDSTs) {
-                                       try {
-                                               TimeZoneInfo.FindSystemTimeZoneById (tz);
-                                       } catch (TimeZoneNotFoundException) {
-                                               // ok;
-                                       } catch (Exception ex) {
-                                               Assert.Fail (string.Format ("Failed to load TZ {0}: {1}", tz, ex.ToString ()));
-                                       }
+                                       TimeZoneInfo.FindSystemTimeZoneById (tz);
                                }
                        }
+
+                       [Test]
+                       [ExpectedException (typeof (TimeZoneNotFoundException))]
+                       public void InvalidName ()
+                       {
+                               TimeZoneInfo.FindSystemTimeZoneById ("N/A");
+                       }
                }
                
                [TestFixture]
index 358298f91e56559e6efbf388bf6228ac13fb0221..409e62066b5f4a5a9cbd133ddff09a8a535fe598 100644 (file)
@@ -326,6 +326,16 @@ public class TimeZoneTest {
                        Assert.IsTrue (tzi.SupportsDaylightSavingTime, "SupportsDaylightSavingTime");
                }
 
+               [Test]
+               public void OldEraToLocalTime ()
+               {
+                       TimeSpan offset = TimeSpan.Zero;
+                       var dto = new DateTimeOffset (new DateTime (1900, 1, 1).Ticks, offset);
+
+                       // Should never throw
+                       dto.ToLocalTime ();
+               }
+
 #if MOBILE
                // On device we cannot read the OS file system to look for /etc/localtime
                // and /usr/share/zoneinfo - so we must initialize the BCL TimeZoneInfo
index 5b7b87f5d95487016e1885af15c16d7c934f9c2c..191d5dd7ac888e8b87e994f98ba0242c999923d8 100644 (file)
@@ -45,45 +45,45 @@ build and the tests will be run along with all the others.
 
 * Tips
 
--- Provide an unique error message for Assertion.Assert ()
+-- Provide an unique error message for Assert.IsTrue ()
 
-Include an unique message for each Assertion.Assert () so that when the assert
+Include an unique message for each Assert.IsTrue () so that when the assert
 fails, it is trivial to locate the failing one. Otherwise, it may be
 difficult to determine which part of the test is failing. A good way
 to ensure unique messages is to use something like #A01, #A02 etc.
 
     Bad:
 
-       Assertion.AssertEquals ("array match", compare[0], i1[0]);
-       Assertion.AssertEquals ("array match", compare[1], i1[1]);
-       Assertion.AssertEquals ("array match", compare[2], i1[2]);
-       Assertion.AssertEquals ("array match", compare[3], i1[3]);
+       Assert.AreEqual (compare[0], i1[0], "array match");
+       Assert.AreEqual (compare[1], i1[1], "array match");
+       Assert.AreEqual (compare[2], i1[2], "array match");
+       Assert.AreEqual (compare[3], i1[3], "array match");
 
     Good:
 
-       Assertion.AssertEquals ("#A01", compare[0], i1[0]);
-       Assertion.AssertEquals ("#A02", compare[1], i1[1]);
-       Assertion.AssertEquals ("#A03", compare[2], i1[2]);
-       Assertion.AssertEquals ("#A04", compare[3], i1[3]);
+       Assert.AreEqual (compare[0], i1[0], "#A01");
+       Assert.AreEqual (compare[1], i1[1], "#A02");
+       Assert.AreEqual (compare[2], i1[2], "#A03");
+       Assert.AreEqual (compare[3], i1[3], "#A04");
 
-Once you used such a number in an Assertion.Assert (), don't change it later on -
+Once you used such a number in an Assert.IsTrue (), don't change it later on -
 people might use it it identify the test in bug reports or in mailing
 lists.
 
--- Use Assertion.AssertEquals () to compare things, not Assertion.Assert ().
+-- Use Assert.AreEqual () to compare things, not Assert.IsTrue ().
 
-Never compare two values with Assertion.Assert () - if the test fails, people
-have no idea what went wrong while Assertion.AssertEquals () reports the failed
+Never compare two values with Assert.IsTrue () - if the test fails, people
+have no idea what went wrong while Assert.AreEqual () reports the failed
 value. Also, make sure the second paramter is the expected value, and the third
 parameter is the actual value.
 
     Bad:
 
-        Assertion.Assert ("A01", myTicks[0] == t1.Ticks);
+        Assert.IsTrue (myTicks[0] == t1.Ticks, "A01");
 
     Good:
 
-        Assertion.AssertEquals ("A01", myTicks[0], t1.Ticks);
+        Assert.AreEqual (myTicks[0], t1.Ticks, "A01");
 
 -- Namespace
 
index 9257cf5734640ca940c548f2982d702fa6b02311..42743232cf72ab204be6f1ea18589b80d6eb29e1 100644 (file)
@@ -249,7 +249,9 @@ namespace System.Net {
 #if MONO
         internal bool AllowMultiValues (string name)
         {
-            return HInfo[name].AllowMultiValues;
+            var hinfo = HInfo[name];
+            // Is common header which supports multi value or it's unknown header
+            return hinfo.AllowMultiValues || hinfo.HeaderName == "";
         }
 #endif
 
index 4de592e9ddfcc9aa299af55da5b79386726e6aad..8a69ca2fae89fc321d3019b5ab1a74177f28d8e7 100644 (file)
@@ -3968,6 +3968,14 @@ namespace System {
 
                 if (hasUnicode && iriParsing && hostNotUnicodeNormalized){
                     flags |= Flags.HostUnicodeNormalized;// no host
+
+#if MONO
+                    // I am not certain this is the best fix but for Unix implicit paths with
+                    // unicode characters the host must be valid (null or non-empty) as
+                    // CreateUriInfo assumes. This should happen only for paths like /foo/path-with-unicode
+                    if (newHost.Length == 0 && (flags & Flags.BasicHostType) != 0)
+                        newHost = null;
+#endif
                 }
 
                  return idx;
index 95f9897c081a7dfbe9bde7d9faef9a60baae01dd..36c5626bcc32dd190a10ff102953fb65f56ea8e3 100644 (file)
@@ -715,6 +715,12 @@ namespace Mono.CSharp {
                                return false;
                        }
 
+                       var interpolated_string = expr as InterpolatedString;
+                       if (interpolated_string != null) {
+                               if (target_type == rc.Module.PredefinedTypes.IFormattable.TypeSpec || target_type == rc.Module.PredefinedTypes.FormattableString.TypeSpec)
+                                       return true;
+                       }
+
                        return ImplicitStandardConversionExists (expr, target_type);
                }
 
index 78bd541791319165ebb9c0b9279148874a74bdcd..d302724c386d84cf5998ceaec7fd542b43e47b2e 100644 (file)
@@ -676,20 +676,16 @@ namespace Mono.CSharp
                        if (!param.IsEmpty) {
                                if (is_valid_property) {
                                        var index_name = declaringType.MemberDefinition.GetAttributeDefaultMember ();
-                                       if (index_name == null) {
+                                       if (index_name == null || index_name != pi.Name) {
                                                is_valid_property = false;
                                        } else {
                                                if (get != null) {
                                                        if (get.IsStatic)
                                                                is_valid_property = false;
-                                                       if (get.Name.IndexOf (index_name, StringComparison.Ordinal) != 4)
-                                                               is_valid_property = false;
                                                }
                                                if (set != null) {
                                                        if (set.IsStatic)
                                                                is_valid_property = false;
-                                                       if (set.Name.IndexOf (index_name, StringComparison.Ordinal) != 4)
-                                                               is_valid_property = false;
                                                }
                                        }
 
index dc5f24016eb3b865b3bf120ba2a9c491661469c8..812652f925fad15efa145069ddb2ec259faa0f7d 100644 (file)
@@ -22,6 +22,7 @@
     <ErrorReport>prompt</ErrorReport>\r
     <WarningLevel>4</WarningLevel>\r
     <UseVSHostingProcess>false</UseVSHostingProcess>\r
+    <Commandlineparameters>y.cs</Commandlineparameters>\r
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
     <DebugType>pdbonly</DebugType>\r
diff --git a/mcs/tests/test-936-lib.il b/mcs/tests/test-936-lib.il
new file mode 100644 (file)
index 0000000..3f84f10
--- /dev/null
@@ -0,0 +1,45 @@
+.assembly extern mscorlib
+{
+}
+
+.assembly 'test-936-lib'
+{
+}
+
+.class public auto ansi sealed beforefieldinit TypeWithIndexer
+       extends [mscorlib]System.Object
+{
+  .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = ( 01 00 04 49 74 65 6D 00 00 )                      // ...Item..
+
+  .method public hidebysig specialname rtspecialname
+          instance void  .ctor() cil managed
+  {
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
+    IL_0006:  ret
+  }
+
+  .field private uint8[] a
+  .field private int32 b
+  .method public hidebysig specialname instance uint8 
+          get_B(int32 index) cil managed
+  {
+    IL_0000:  ldc.i4.0
+    IL_0001:  conv.u1
+    IL_0002:  ret
+  }
+
+  .method public hidebysig specialname 
+          instance void  set_O(int32 index,
+                           uint8 A_1) cil managed
+  {
+    IL_0000:  ret
+  }
+
+  .property instance uint8 Item(int32)
+  {
+    .get instance uint8 TypeWithIndexer::get_B(int32)
+    .set instance void TypeWithIndexer::set_O(int32,
+                                          uint8)
+  }
+}
diff --git a/mcs/tests/test-936.cs b/mcs/tests/test-936.cs
new file mode 100644 (file)
index 0000000..ae5af06
--- /dev/null
@@ -0,0 +1,11 @@
+// Compiler options: -r:test-936-lib.dll
+
+class X
+{
+       public static void Main ()
+       {
+               TypeWithIndexer a = new TypeWithIndexer ();
+               var x = a[0];
+               a[0] = x;
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-interpolation-10.cs b/mcs/tests/test-interpolation-10.cs
new file mode 100644 (file)
index 0000000..15f5e21
--- /dev/null
@@ -0,0 +1,25 @@
+using System;
+
+class Program
+{
+       static int counter;
+
+       static int Main ()
+       {
+               FormatPrint ($"Case {1}");
+               if (counter != 1)
+                       return 1;
+
+               FormatPrint ($"Case {3}");
+               if (counter != 2)
+                       return 2;
+
+               return 0;
+       }
+
+       static void FormatPrint (FormattableString message)
+       {
+               Console.WriteLine(message);
+               ++counter;
+       }
+}
index 79fc14d77a9089ffffa2fa431a6acb78cc25fffd..8d87222999dd12b67d31e7a4da53c4c87042b5e3 100644 (file)
       </method>
     </type>
   </test>
+  <test name="test-936.cs">
+    <type name="X">
+      <method name="Void Main()" attrs="150">
+        <size>24</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-94.cs">
     <type name="Base">
       <method name="Int32 IVehicle.Start()" attrs="481">
       </method>
     </type>
   </test>
+  <test name="test-interpolation-10.cs">
+    <type name="Program">
+      <method name="Int32 Main()" attrs="145">
+        <size>106</size>
+      </method>
+      <method name="Void FormatPrint(System.FormattableString)" attrs="145">
+        <size>20</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-iter-01.cs">
     <type name="X">
       <method name="Int32 Main()" attrs="150">
index 6e07617be3ed6e8fcc86a9bfb68cb99571db7292..d8b86335579a2cdbc66a2ce9fd42c99b6d2059ad 100644 (file)
                <type fullname="System.Runtime.Remoting.Messaging.CallContext">
                        <method name="SetCurrentCallContext" />
                </type>
-               <type fullname="System.Runtime.Remoting.Messaging.MonoMethodMessage" preserve="fields" />
+               <type fullname="System.Runtime.Remoting.Messaging.MonoMethodMessage" preserve="fields">
+                       <method name="InitMessage" />
+               </type>
                <type fullname="System.Runtime.Remoting.Proxies.RealProxy" preserve="fields">
                        <method name="PrivateInvoke" />
                        <method name="GetAppDomainTarget" />
index 6d0da527bd65c54a31c77c2f1b0255c0d43add1a..4785e1504e3ff98e895c17cb68e6296bf75dd171 100644 (file)
@@ -996,7 +996,7 @@ wapi_sendfile (guint32 socket, gpointer fd, guint32 bytes_to_write, guint32 byte
                do {
                        n = send (socket, buffer, n, 0); /* short sends? enclose this in a loop? */
                } while (n == -1 && errno == EINTR && !_wapi_thread_cur_apc_pending ());
-       } while (n != -1);
+       } while (n != -1 && errno == EINTR && !_wapi_thread_cur_apc_pending ());
 
        if (n == -1) {
                gint errnum = errno;
index 147fbe83a78c2ce70fb02e43b311afa43a9e9278..e4419f293228df23373567e0d873400ae7d82271 100644 (file)
@@ -1,8 +1,6 @@
 /Makefile
 /Makefile.in
 /Makefile.am
-/pedump
-/pedump.exe
 /monosn
 /monodiet
 /.libs
index 87f9a916dd941011e2b0ca66b0ffb1eda5f74971..3639f3e5eb0e9b4a6364b91ec3822c5eda578c11 100644 (file)
@@ -32,12 +32,6 @@ if PLATFORM_ANDROID
 platform_sources += ../../support/libm/complex.c
 endif
 
-if SHARED_MONO
-if SUPPORT_SGEN
-bin_PROGRAMS = pedump
-endif
-endif
-
 #
 # libtool is not capable of creating static/shared versions of the same
 # convenience lib, so we have to do it ourselves
@@ -297,32 +291,5 @@ libmonoruntimeinclude_HEADERS = \
        tokentype.h             \
        verify.h                
 
-if DTRACE_G_REQUIRED
-
-PEDUMP_DTRACE_OBJECT = pedump-dtrace.$(OBJEXT)
-
-pedump-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d $(shared_sgen_libraries) ../io-layer/libwapi.la ../utils/libmonoutils.la
-       DTRACE="$(DTRACE)" DTRACEFLAGS="$(DTRACEFLAGS)" AR="$(AR)" $(SHELL) $(top_srcdir)/data/dtrace-prelink.sh \
-       --pic pedump-dtrace.$(OBJEXT) $(top_srcdir)/data/mono.d $(shared_sgen_libraries) ../io-layer/libwapi.la ../utils/libmonoutils.la
-
-else
-PEDUMP_DTRACE_OBJECT = 
-endif
-
-if SHARED_MONO
-pedump_SOURCES =               \
-       pedump.c
-
-$(top_srcdir)/mono/sgen/libmonosgen.la:
-       make -w -C $(top_srcdir)/mono/sgen libmonosgen.la
-
-pedump_LDADD = $(sgen_libraries) $(top_srcdir)/mono/sgen/libmonosgen.la ../io-layer/libwapi.la ../utils/libmonoutils.la \
-       $(GLIB_LIBS) -lm $(LIBICONV) $(PEDUMP_DTRACE_OBJECT)
-
-if PLATFORM_DARWIN
-pedump_LDFLAGS=-framework CoreFoundation -framework Foundation
-endif
-endif
-
 EXTRA_DIST = $(win32_sources) $(unix_sources) $(null_sources) runtime.h \
                threadpool-ms-io-poll.c threadpool-ms-io-epoll.c threadpool-ms-io-kqueue.c
index 9bd5f0f645c4eaf3f1957382f3b9377447c4d2a1..c57d8e9fb5b9f9db68819846e311953c5a4e6671 100644 (file)
@@ -82,7 +82,7 @@
  * Changes which are already detected at runtime, like the addition
  * of icalls, do not require an increment.
  */
-#define MONO_CORLIB_VERSION 149
+#define MONO_CORLIB_VERSION 150
 
 typedef struct
 {
index 2bf3eb6c400b6bda3a0068a5a64ddbcc382456dd..4436229376e10101b1d16f827601c72f466d2328 100644 (file)
@@ -23,6 +23,7 @@
 #include "domain-internals.h"
 #include "appdomain.h"
 #include "object.h"
+#include "object-internals.h"
 #include "loader.h"
 #include "threads.h"
 #include "environment.h"
index 9f413224e0237fb97ec1e9833dd0ce517b31af27..432ddd6bea5c9653957967876a3728bbafdfb1cc 100644 (file)
@@ -706,9 +706,6 @@ ICALL(CONTEXT_2, "ReleaseContext", ves_icall_System_Runtime_Remoting_Contexts_Co
 ICALL_TYPE(ARES, "System.Runtime.Remoting.Messaging.AsyncResult", ARES_1)
 ICALL(ARES_1, "Invoke", ves_icall_System_Runtime_Remoting_Messaging_AsyncResult_Invoke)
 
-ICALL_TYPE(MONOMM, "System.Runtime.Remoting.Messaging.MonoMethodMessage", MONOMM_1)
-ICALL(MONOMM_1, "InitMessage", ves_icall_MonoMethodMessage_InitMessage)
-
 #ifndef DISABLE_REMOTING
 ICALL_TYPE(REALP, "System.Runtime.Remoting.Proxies.RealProxy", REALP_1)
 ICALL(REALP_1, "InternalGetProxyType", ves_icall_Remoting_RealProxy_InternalGetProxyType)
index 636d7eab796547ce4fb7d2f79a42a5193f7cad71..d1a6856c9b44e7824e284b4eda349b274817f442 100644 (file)
@@ -7331,16 +7331,6 @@ ves_icall_System_Runtime_Versioning_VersioningHelper_GetRuntimeId (void)
        return 9;
 }
 
-ICALL_EXPORT void
-ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this_obj, 
-                                        MonoReflectionMethod *method,
-                                        MonoArray *out_args)
-{
-       MonoError error;
-       mono_message_init (mono_object_domain (this_obj), this_obj, method, out_args, &error);
-       mono_error_set_pending_exception (&error);
-}
-
 #ifndef DISABLE_REMOTING
 ICALL_EXPORT MonoBoolean
 ves_icall_IsTransparentProxy (MonoObject *proxy)
index c58c4b6794a056cdcec340a869748af3bb66bfa0..161bd0031a37893599330767c38280d1b288328b 100644 (file)
@@ -1802,6 +1802,7 @@ mono_image_close_except_pools (MonoImage *image)
        free_hash (image->stfld_wrapper_cache);
        free_hash (image->isinst_cache);
        free_hash (image->castclass_cache);
+       free_hash (image->icall_wrapper_cache);
        free_hash (image->proxy_isinst_cache);
        free_hash (image->var_cache_slow);
        free_hash (image->mvar_cache_slow);
index 86e66ece626ce9a7560ea03a47cf58d44222bf69..6dbf07f79414184cba5de202f48ecdc4484bd312 100644 (file)
@@ -962,7 +962,7 @@ mono_string_utf16_to_builder (MonoStringBuilder *sb, gunichar2 *text)
  *
  * Returns: a utf8 string with the contents of the StringBuilder.
  *
- * The return value must be released with g_free.
+ * The return value must be released with mono_marshal_free.
  *
  * This is a JIT icall, it sets the pending exception and returns NULL on error.
  */
@@ -983,14 +983,14 @@ mono_string_builder_to_utf8 (MonoStringBuilder *sb)
 
        if (gerror) {
                g_error_free (gerror);
-               g_free (str_utf16);
+               mono_marshal_free (str_utf16);
                mono_set_pending_exception (mono_get_exception_execution_engine ("Failed to convert StringBuilder from utf16 to utf8"));
                return NULL;
        } else {
                guint len = mono_string_builder_capacity (sb) + 1;
                gchar *res = (gchar *)mono_marshal_alloc (len * sizeof (gchar), &error);
                if (!mono_error_ok (&error)) {
-                       g_free (str_utf16);
+                       mono_marshal_free (str_utf16);
                        g_free (tmp);
                        mono_error_set_pending_exception (&error);
                        return NULL;
@@ -1000,7 +1000,7 @@ mono_string_builder_to_utf8 (MonoStringBuilder *sb)
                memcpy (res, tmp, str_len * sizeof (gchar));
                res[str_len] = '\0';
 
-               g_free (str_utf16);
+               mono_marshal_free (str_utf16);
                g_free (tmp);
                return res;
        }
@@ -1014,7 +1014,8 @@ mono_string_builder_to_utf8 (MonoStringBuilder *sb)
  *
  * Returns: a utf16 string with the contents of the StringBuilder.
  *
- * The return value must not be freed.
+ * The return value must be released with mono_marshal_free.
+ *
  * This is a JIT icall, it sets the pending exception and returns NULL on error.
  */
 gunichar2*
@@ -4457,6 +4458,10 @@ mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gcon
        int i;
        WrapperInfo *info;
        
+       GHashTable *cache = get_cache (&mono_defaults.object_class->image->icall_wrapper_cache, mono_aligned_addr_hash, NULL);
+       if ((res = mono_marshal_find_in_cache (cache, (gpointer) func)))
+               return res;
+
        g_assert (sig->pinvoke);
 
        mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_MANAGED_TO_NATIVE);
@@ -4491,7 +4496,7 @@ mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gcon
 
        info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_ICALL_WRAPPER);
        info->d.icall.func = (gpointer)func;
-       res = mono_mb_create (mb, csig, csig->param_count + 16, info);
+       res = mono_mb_create_and_cache_full (cache, (gpointer) func, mb, csig, csig->param_count + 16, info, NULL);
        mono_mb_free (mb);
 
        return res;
index ba5f9d72e1aa81d635a3e6e5d1d1979da9985620..96f6a5da7c90f3c924b02fe338f3a3eb4f728f95 100644 (file)
@@ -334,6 +334,8 @@ struct _MonoImage {
        GHashTable *ldflda_wrapper_cache;
        GHashTable *stfld_wrapper_cache;
        GHashTable *isinst_cache;
+
+       GHashTable *icall_wrapper_cache;
        GHashTable *castclass_cache;
        GHashTable *proxy_isinst_cache;
        GHashTable *rgctx_template_hash; /* LOCKING: templates lock */
index b9a305121641975286467b84392ceba8856a4111..3dfd3c4e08f720871d564e55926e9009fa568e7a 100644 (file)
@@ -951,11 +951,6 @@ mono_monitor_try_enter_internal (MonoObject *obj, guint32 ms, gboolean allow_int
 
        LOCK_DEBUG (g_message("%s: (%d) Trying to lock object %p (%d ms)", __func__, id, obj, ms));
 
-       if (G_UNLIKELY (!obj)) {
-               mono_set_pending_exception (mono_get_exception_argument_null ("obj"));
-               return FALSE;
-       }
-
        lw.sync = obj->synchronisation;
 
        if (G_LIKELY (lock_word_is_free (lw))) {
@@ -1001,18 +996,31 @@ mono_monitor_try_enter_internal (MonoObject *obj, guint32 ms, gboolean allow_int
 gboolean 
 mono_monitor_enter (MonoObject *obj)
 {
+       if (G_UNLIKELY (!obj)) {
+               mono_set_pending_exception (mono_get_exception_argument_null ("obj"));
+               return FALSE;
+       }
        return mono_monitor_try_enter_internal (obj, INFINITE, FALSE) == 1;
 }
 
 gboolean 
 mono_monitor_enter_fast (MonoObject *obj)
 {
+       if (G_UNLIKELY (!obj)) {
+               /* don't set pending exn on the fast path, just return
+                * FALSE and let the slow path take care of it. */
+               return FALSE;
+       }
        return mono_monitor_try_enter_internal (obj, 0, FALSE) == 1;
 }
 
 gboolean
 mono_monitor_try_enter (MonoObject *obj, guint32 ms)
 {
+       if (G_UNLIKELY (!obj)) {
+               mono_set_pending_exception (mono_get_exception_argument_null ("obj"));
+               return FALSE;
+       }
        return mono_monitor_try_enter_internal (obj, ms, FALSE) == 1;
 }
 
@@ -1075,6 +1083,10 @@ void
 ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (MonoObject *obj, guint32 ms, char *lockTaken)
 {
        gint32 res;
+       if (G_UNLIKELY (!obj)) {
+               mono_set_pending_exception (mono_get_exception_argument_null ("obj"));
+               return;
+       }
        do {
                res = mono_monitor_try_enter_internal (obj, ms, TRUE);
                /*This means we got interrupted during the wait and didn't got the monitor.*/
index ee0f6ab546ab55a4c933df452df3add21e567ed2..fb76fb8a72f53055f229ff31089b5021f0e33cfd 100644 (file)
@@ -1746,13 +1746,13 @@ mono_runtime_run_main_checked (MonoMethod *method, int argc, char* argv[],
 
 int
 mono_runtime_try_run_main (MonoMethod *method, int argc, char* argv[],
-                          MonoObject **exc, MonoError *error);
+                          MonoObject **exc);
 
 int
 mono_runtime_exec_main_checked (MonoMethod *method, MonoArray *args, MonoError *error);
 
 int
-mono_runtime_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc, MonoError *error);
+mono_runtime_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc);
 
 
 #endif /* __MONO_OBJECT_INTERNALS_H__ */
index 7e4c9dc4e062b84777f32afaf1ab51e5ddd3ea04..6d67358ec0784973a90d45d3cd1a9818e1b58d97 100644 (file)
@@ -4289,11 +4289,7 @@ mono_runtime_run_main (MonoMethod *method, int argc, char* argv[],
        MonoArray *args = prepare_run_main (method, argc, argv);
        int res;
        if (exc) {
-               res = mono_runtime_try_exec_main (method, args, exc, &error);
-               if (*exc == NULL && !is_ok (&error))
-                       *exc = (MonoObject*) mono_error_convert_to_exception (&error);
-               else
-                       mono_error_cleanup (&error);
+               res = mono_runtime_try_exec_main (method, args, exc);
        } else {
                res = mono_runtime_exec_main_checked (method, args, &error);
                mono_error_raise_exception (&error); /* OK to throw, external only without a better alternative */
@@ -4340,12 +4336,11 @@ mono_runtime_run_main_checked (MonoMethod *method, int argc, char* argv[],
  */
 int
 mono_runtime_try_run_main (MonoMethod *method, int argc, char* argv[],
-                          MonoObject **exc, MonoError *error)
+                          MonoObject **exc)
 {
        g_assert (exc);
-       mono_error_init (error);
        MonoArray *args = prepare_run_main (method, argc, argv);
-       return mono_runtime_try_exec_main (method, args, exc, error);
+       return mono_runtime_try_exec_main (method, args, exc);
 }
 
 
@@ -4793,14 +4788,13 @@ do_exec_main_checked (MonoMethod *method, MonoArray *args, MonoError *error)
 }
 
 static int
-do_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc, MonoError *error)
+do_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc)
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
        gpointer pa [1];
        int rval;
 
-       mono_error_init (error);
        g_assert (args);
        g_assert (exc);
 
@@ -4808,12 +4802,13 @@ do_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc, MonoErr
 
        /* FIXME: check signature of method */
        if (mono_method_signature (method)->ret->type == MONO_TYPE_I4) {
+               MonoError inner_error;
                MonoObject *res;
-               res = mono_runtime_try_invoke (method, NULL, pa, exc, error);
-               if (*exc == NULL && !mono_error_ok (error))
-                       *exc = (MonoObject*) mono_error_convert_to_exception (error);
+               res = mono_runtime_try_invoke (method, NULL, pa, exc, &inner_error);
+               if (*exc == NULL && !mono_error_ok (&inner_error))
+                       *exc = (MonoObject*) mono_error_convert_to_exception (&inner_error);
                else
-                       mono_error_cleanup (error);
+                       mono_error_cleanup (&inner_error);
 
                if (*exc == NULL)
                        rval = *(guint32 *)((char *)res + sizeof (MonoObject));
@@ -4822,11 +4817,12 @@ do_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc, MonoErr
 
                mono_environment_exitcode_set (rval);
        } else {
-               mono_runtime_try_invoke (method, NULL, pa, exc, error);
-               if (*exc == NULL && !mono_error_ok (error))
-                       *exc = (MonoObject*) mono_error_convert_to_exception (error);
+               MonoError inner_error;
+               mono_runtime_try_invoke (method, NULL, pa, exc, &inner_error);
+               if (*exc == NULL && !mono_error_ok (&inner_error))
+                       *exc = (MonoObject*) mono_error_convert_to_exception (&inner_error);
                else
-                       mono_error_cleanup (error);
+                       mono_error_cleanup (&inner_error);
 
                if (*exc == NULL)
                        rval = 0;
@@ -4854,11 +4850,7 @@ mono_runtime_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc)
        MonoError error;
        prepare_thread_to_exec_main (mono_object_domain (args), method);
        if (exc) {
-               int rval = do_try_exec_main (method, args, exc, &error);
-               if (*exc == NULL && !is_ok (&error))
-                       *exc = (MonoObject*) mono_error_convert_to_exception (&error);
-               else
-                       mono_error_cleanup (&error);
+               int rval = do_try_exec_main (method, args, exc);
                return rval;
        } else {
                int rval = do_exec_main_checked (method, args, &error);
@@ -4888,11 +4880,10 @@ mono_runtime_exec_main_checked (MonoMethod *method, MonoArray *args, MonoError *
  * On failure sets @error if Main couldn't be executed, or @exc if it threw an exception.
  */
 int
-mono_runtime_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc, MonoError *error)
+mono_runtime_try_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc)
 {
-       mono_error_init (error);
        prepare_thread_to_exec_main (mono_object_domain (args), method);
-       return do_try_exec_main (method, args, exc, error);
+       return do_try_exec_main (method, args, exc);
 }
 
 
@@ -7580,88 +7571,24 @@ mono_message_init (MonoDomain *domain,
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       static MonoClass *object_array_klass;
-       static MonoClass *byte_array_klass;
-       static MonoClass *string_array_klass;
-       mono_error_init (error);
-       MonoMethodSignature *sig = mono_method_signature (method->method);
-       MonoString *name;
-       MonoArray *arr;
-       int i, j;
-       char **names;
-       guint8 arg_type;
-
-       if (!object_array_klass) {
-               MonoClass *klass;
-
-               klass = mono_array_class_get (mono_defaults.byte_class, 1);
-               g_assert (klass);
-               byte_array_klass = klass;
-
-               klass = mono_array_class_get (mono_defaults.string_class, 1);
-               g_assert (klass);
-               string_array_klass = klass;
-
-               klass = mono_array_class_get (mono_defaults.object_class, 1);
-               g_assert (klass);
+       static MonoMethod *init_message_method = NULL;
 
-               mono_atomic_store_release (&object_array_klass, klass);
+       if (!init_message_method) {
+               init_message_method = mono_class_get_method_from_name (mono_defaults.mono_method_message_class, "InitMessage", 2);
+               g_assert (init_message_method != NULL);
        }
 
-       MONO_OBJECT_SETREF (this_obj, method, method);
-
-       arr = mono_array_new_specific_checked (mono_class_vtable (domain, object_array_klass), sig->param_count, error);
-       return_val_if_nok (error, FALSE);
-
-       MONO_OBJECT_SETREF (this_obj, args, arr);
-
-       arr = mono_array_new_specific_checked (mono_class_vtable (domain, byte_array_klass), sig->param_count, error);
-       return_val_if_nok (error, FALSE);
-
-       MONO_OBJECT_SETREF (this_obj, arg_types, arr);
-
-       this_obj->async_result = NULL;
-       this_obj->call_type = CallType_Sync;
-
-       names = g_new (char *, sig->param_count);
-       mono_method_get_param_names (method->method, (const char **) names);
-
-       arr = mono_array_new_specific_checked (mono_class_vtable (domain, string_array_klass), sig->param_count, error);
-       if (!is_ok (error))
-               goto fail;
-
-       MONO_OBJECT_SETREF (this_obj, names, arr);
+       mono_error_init (error);
+       /* FIXME set domain instead? */
+       g_assert (domain == mono_domain_get ());
        
-       for (i = 0; i < sig->param_count; i++) {
-               name = mono_string_new_checked (domain, names [i], error);
-               if (!is_ok (error))
-                       goto fail;
-               mono_array_setref (this_obj->names, i, name);   
-       }
+       gpointer args[2];
 
-       g_free (names);
-       for (i = 0, j = 0; i < sig->param_count; i++) {
-               if (sig->params [i]->byref) {
-                       if (out_args) {
-                               MonoObject* arg = (MonoObject *)mono_array_get (out_args, gpointer, j);
-                               mono_array_setref (this_obj->args, i, arg);
-                               j++;
-                       }
-                       arg_type = 2;
-                       if (!(sig->params [i]->attrs & PARAM_ATTRIBUTE_OUT))
-                               arg_type |= 1;
-               } else {
-                       arg_type = 1;
-                       if (sig->params [i]->attrs & PARAM_ATTRIBUTE_OUT)
-                               arg_type |= 4;
-               }
-               mono_array_set (this_obj->arg_types, guint8, i, arg_type);
-       }
+       args[0] = method;
+       args[1] = out_args;
 
-       return TRUE;
-fail:
-       g_free (names);
-       return FALSE;
+       mono_runtime_invoke_checked (init_message_method, this_obj, args, error);
+       return is_ok (error);
 }
 
 #ifndef DISABLE_REMOTING
index 71b4cb495861d7f923827b6c07c23737b799a879..d70d6f07bef754c0ad0f0b9f42dbb000b6e278a3 100644 (file)
@@ -62,7 +62,7 @@ typedef struct {
        unsigned short opval;
 } MonoOpcode;
 
-extern const MonoOpcode mono_opcodes [];
+MONO_API extern const MonoOpcode mono_opcodes [];
 
 MONO_API const char*
 mono_opcode_name (int opcode);
diff --git a/mono/metadata/pedump.c b/mono/metadata/pedump.c
deleted file mode 100644 (file)
index eac9bfb..0000000
+++ /dev/null
@@ -1,750 +0,0 @@
-/*
- * pedump.c: Dumps the contents of an extended PE/COFF file
- *
- * Author:
- *   Miguel de Icaza (miguel@ximian.com)
- *
- * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
- * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
- * Licensed under the MIT license. See LICENSE file in the project root for full license information.
- */
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "image.h"
-#include <glib.h>
-#include "cil-coff.h"
-#include "mono-endian.h"
-#include "verify.h"
-#include <mono/metadata/class.h>
-#include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/tokentype.h>
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/assembly.h>
-#include <mono/metadata/metadata-internals.h>
-#include <mono/metadata/class-internals.h>
-#include <mono/metadata/verify-internals.h>
-#include <mono/metadata/marshal.h>
-#include "mono/utils/mono-digest.h"
-#include <mono/utils/mono-mmap.h>
-#include <mono/utils/mono-counters.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-gboolean dump_data = TRUE;
-gboolean verify_pe = FALSE;
-gboolean verify_metadata = FALSE;
-gboolean verify_code = FALSE;
-gboolean verify_partial_md = FALSE;
-
-static MonoAssembly *pedump_preload (MonoAssemblyName *aname, gchar **assemblies_path, gpointer user_data);
-static void pedump_assembly_load_hook (MonoAssembly *assembly, gpointer user_data);
-static MonoAssembly *pedump_assembly_search_hook (MonoAssemblyName *aname, gpointer user_data);
-
-/* unused
-static void
-hex_dump (const char *buffer, int base, int count)
-{
-       int i;
-       
-       for (i = 0; i < count; i++){
-               if ((i % 16) == 0)
-                       printf ("\n0x%08x: ", (unsigned char) base + i);
-
-               printf ("%02x ", (unsigned char) (buffer [i]));
-       }
-}
-*/
-
-static void
-hex8 (const char *label, unsigned char x)
-{
-       printf ("\t%s: 0x%02x\n", label, (unsigned char) x);
-}
-
-static void
-hex16 (const char *label, guint16 x)
-{
-       printf ("\t%s: 0x%04x\n", label, x);
-}
-
-static void
-hex32 (const char *label, guint32 x)
-{
-       printf ("\t%s: 0x%08x\n", label, x);
-}
-
-static void
-dump_coff_header (MonoCOFFHeader *coff)
-{
-       printf ("\nCOFF Header:\n");
-       hex16 ("                Machine", coff->coff_machine);
-       hex16 ("               Sections", coff->coff_sections);
-       hex32 ("             Time stamp", coff->coff_time);
-       hex32 ("Pointer to Symbol Table", coff->coff_symptr);
-       hex32 ("           Symbol Count", coff->coff_symcount);
-       hex16 ("   Optional Header Size", coff->coff_opt_header_size);
-       hex16 ("        Characteristics", coff->coff_attributes);
-
-}
-
-static void
-dump_pe_header (MonoPEHeader *pe)
-{
-       printf ("\nPE Header:\n");
-       hex16 ("         Magic (0x010b)", pe->pe_magic);
-       hex8  ("             LMajor (6)", pe->pe_major);
-       hex8  ("             LMinor (0)", pe->pe_minor);
-       hex32 ("              Code Size", pe->pe_code_size);
-       hex32 ("  Initialized Data Size", pe->pe_data_size);
-       hex32 ("Uninitialized Data Size", pe->pe_uninit_data_size);
-       hex32 ("        Entry Point RVA", pe->pe_rva_entry_point);
-       hex32 ("          Code Base RVA", pe->pe_rva_code_base);
-       hex32 ("          Data Base RVA", pe->pe_rva_data_base);
-       printf ("\n");
-}
-
-static void
-dump_nt_header (MonoPEHeaderNT *nt)
-{
-       printf ("\nNT Header:\n");
-
-       hex32 ("   Image Base (0x400000)", nt->pe_image_base);
-       hex32 ("Section Alignment (8192)", nt->pe_section_align);
-       hex32 ("   File Align (512/4096)", nt->pe_file_alignment);
-       hex16 ("            OS Major (4)", nt->pe_os_major);
-       hex16 ("            OS Minor (0)", nt->pe_os_minor);
-       hex16 ("          User Major (0)", nt->pe_user_major);
-       hex16 ("          User Minor (0)", nt->pe_user_minor);
-       hex16 ("        Subsys major (4)", nt->pe_subsys_major);
-       hex16 ("        Subsys minor (0)", nt->pe_subsys_minor);
-       hex32 ("               Reserverd", nt->pe_reserved_1);
-       hex32 ("              Image Size", nt->pe_image_size);
-       hex32 ("             Header Size", nt->pe_header_size);
-       hex32 ("            Checksum (0)", nt->pe_checksum);
-       hex16 ("               Subsystem", nt->pe_subsys_required);
-       hex16 ("           DLL Flags (0)", nt->pe_dll_flags);
-       hex32 (" Stack Reserve Size (1M)", nt->pe_stack_reserve);
-       hex32 ("Stack commit Size (4096)", nt->pe_stack_commit);
-       hex32 ("  Heap Reserve Size (1M)", nt->pe_heap_reserve);
-       hex32 (" Heap Commit Size (4096)", nt->pe_heap_commit);
-       hex32 ("      Loader flags (0x1)", nt->pe_loader_flags);
-       hex32 ("   Data Directories (16)", nt->pe_data_dir_count);
-}
-
-static void
-dent (const char *label, MonoPEDirEntry de)
-{
-       printf ("\t%s: 0x%08x [0x%08x]\n", label, de.rva, de.size);
-}
-
-static void
-dump_blob (const char *desc, const char* p, guint32 size)
-{
-       int i;
-
-       printf ("%s", desc);
-       if (!p) {
-               printf (" none\n");
-               return;
-       }
-
-       for (i = 0; i < size; ++i) {
-               if (!(i % 16))
-                       printf ("\n\t");
-               printf (" %02X", p [i] & 0xFF);
-       }
-       printf ("\n");
-}
-
-static void
-dump_public_key (MonoImage *m)
-{
-       guint32 size;
-       const char *p;
-
-       p = mono_image_get_public_key (m, &size);
-       dump_blob ("\nPublic key:", p, size);
-}
-
-static void
-dump_strong_name (MonoImage *m)
-{
-       guint32 size;
-       const char *p;
-
-       p = mono_image_get_strong_name (m, &size);
-       dump_blob ("\nStrong name:", p, size);
-}
-
-static void
-dump_datadir (MonoPEDatadir *dd)
-{
-       printf ("\nData directories:\n");
-       dent ("     Export Table", dd->pe_export_table);
-       dent ("     Import Table", dd->pe_import_table);
-       dent ("   Resource Table", dd->pe_resource_table);
-       dent ("  Exception Table", dd->pe_exception_table);
-       dent ("Certificate Table", dd->pe_certificate_table);
-       dent ("      Reloc Table", dd->pe_reloc_table);
-       dent ("            Debug", dd->pe_debug);
-       dent ("        Copyright", dd->pe_copyright);
-       dent ("       Global Ptr", dd->pe_global_ptr);
-       dent ("        TLS Table", dd->pe_tls_table);
-       dent ("Load Config Table", dd->pe_load_config_table);
-       dent ("     Bound Import", dd->pe_bound_import);
-       dent ("              IAT", dd->pe_iat);
-       dent ("Delay Import Desc", dd->pe_delay_import_desc);
-       dent ("       CLI Header", dd->pe_cli_header);
-}
-
-static void
-dump_dotnet_header (MonoDotNetHeader *header)
-{
-       dump_coff_header (&header->coff);
-       dump_pe_header (&header->pe);
-       dump_nt_header (&header->nt);
-       dump_datadir (&header->datadir);
-}
-
-static void
-dump_section_table (MonoSectionTable *st)
-{
-       guint32 flags = st->st_flags;
-               
-       printf ("\n\tName: %s\n", st->st_name);
-       hex32 ("   Virtual Size", st->st_virtual_size);
-       hex32 ("Virtual Address", st->st_virtual_address);
-       hex32 ("  Raw Data Size", st->st_raw_data_size);
-       hex32 ("   Raw Data Ptr", st->st_raw_data_ptr);
-       hex32 ("      Reloc Ptr", st->st_reloc_ptr);
-       hex32 ("     LineNo Ptr", st->st_lineno_ptr);
-       hex16 ("    Reloc Count", st->st_reloc_count);
-       hex16 ("     Line Count", st->st_line_count);
-
-       printf ("\tFlags: %s%s%s%s%s%s%s%s%s%s\n",
-               (flags & SECT_FLAGS_HAS_CODE) ? "code, " : "",
-               (flags & SECT_FLAGS_HAS_INITIALIZED_DATA) ? "data, " : "",
-               (flags & SECT_FLAGS_HAS_UNINITIALIZED_DATA) ? "bss, " : "",
-               (flags & SECT_FLAGS_MEM_DISCARDABLE) ? "discard, " : "",
-               (flags & SECT_FLAGS_MEM_NOT_CACHED) ? "nocache, " : "",
-               (flags & SECT_FLAGS_MEM_NOT_PAGED) ? "nopage, " : "",
-               (flags & SECT_FLAGS_MEM_SHARED) ? "shared, " : "",
-               (flags & SECT_FLAGS_MEM_EXECUTE) ? "exec, " : "",
-               (flags & SECT_FLAGS_MEM_READ) ? "read, " : "",
-               (flags & SECT_FLAGS_MEM_WRITE) ? "write" : "");
-}
-
-static void
-dump_sections (MonoCLIImageInfo *iinfo)
-{
-       const int top = iinfo->cli_header.coff.coff_sections;
-       int i;
-       
-       for (i = 0; i < top; i++)
-               dump_section_table (&iinfo->cli_section_tables [i]);
-}
-
-static void
-dump_cli_header (MonoCLIHeader *ch)
-{
-       printf ("\n");
-       printf ("          CLI header size: %d\n", ch->ch_size);
-       printf ("         Runtime required: %d.%d\n", ch->ch_runtime_major, ch->ch_runtime_minor);
-       printf ("                    Flags: %s, %s, %s, %s\n",
-               (ch->ch_flags & CLI_FLAGS_ILONLY ? "ilonly" : "contains native"),
-               (ch->ch_flags & CLI_FLAGS_32BITREQUIRED ? "32bits" : "32/64"),
-               (ch->ch_flags & CLI_FLAGS_TRACKDEBUGDATA ? "trackdebug" : "no-trackdebug"),
-               (ch->ch_flags & CLI_FLAGS_STRONGNAMESIGNED ? "strongnamesigned" : "notsigned"));
-       dent   ("         Metadata", ch->ch_metadata);
-       hex32  ("Entry Point Token", ch->ch_entry_point);
-       dent   ("     Resources at", ch->ch_resources);
-       dent   ("   Strong Name at", ch->ch_strong_name);
-       dent   ("  Code Manager at", ch->ch_code_manager_table);
-       dent   ("  VTableFixups at", ch->ch_vtable_fixups);
-       dent   ("     EAT jumps at", ch->ch_export_address_table_jumps);
-}      
-
-static void
-dsh (const char *label, MonoImage *meta, MonoStreamHeader *sh)
-{
-       printf ("%s: 0x%08x - 0x%08x [%d == 0x%08x]\n",
-               label,
-               (int)(sh->data - meta->raw_metadata), (int)(sh->data + sh->size - meta->raw_metadata),
-               sh->size, sh->size);
-}
-
-static void
-dump_metadata_header (MonoImage *meta)
-{
-       printf ("\nMetadata header:\n");
-       printf ("           Version: %d.%d\n", meta->md_version_major, meta->md_version_minor);
-       printf ("    Version string: %s\n", meta->version);
-}
-
-static void
-dump_metadata_ptrs (MonoImage *meta)
-{
-       printf ("\nMetadata pointers:\n");
-       dsh ("\tTables (#~)", meta, &meta->heap_tables);
-       dsh ("\t    Strings", meta, &meta->heap_strings);
-       dsh ("\t       Blob", meta, &meta->heap_blob);
-       dsh ("\tUser string", meta, &meta->heap_us);
-       dsh ("\t       GUID", meta, &meta->heap_guid);
-}
-
-static void
-dump_metadata (MonoImage *meta)
-{
-       int table;
-
-       dump_metadata_header (meta);
-
-       dump_metadata_ptrs (meta);
-
-       printf ("Rows:\n");
-       for (table = 0; table < MONO_TABLE_NUM; table++){
-               if (meta->tables [table].rows == 0)
-                       continue;
-               printf ("Table %s: %d records (%d bytes, at %x)\n",
-                       mono_meta_table_name (table),
-                       meta->tables [table].rows,
-                       meta->tables [table].row_size,
-                       (unsigned int)(meta->tables [table].base - meta->raw_data)
-                       );
-       }
-}
-
-static void
-dump_methoddef (MonoImage *metadata, guint32 token)
-{
-       const char *loc;
-
-       if (!token)
-               return;
-       loc = mono_metadata_locate_token (metadata, token);
-
-       printf ("RVA for Entry Point: 0x%08x\n", read32 (loc));
-}
-
-static void
-dump_dotnet_iinfo (MonoImage *image)
-{
-       MonoCLIImageInfo *iinfo = (MonoCLIImageInfo *)image->image_info;
-
-       dump_dotnet_header (&iinfo->cli_header);
-       dump_sections (iinfo);
-       dump_cli_header (&iinfo->cli_cli_header);
-       dump_strong_name (image);
-       dump_public_key (image);
-       dump_metadata (image);
-
-       dump_methoddef (image, iinfo->cli_cli_header.ch_entry_point);
-}
-
-static int
-dump_verify_info (MonoImage *image, int flags)
-{
-       GSList *errors, *tmp;
-       int count = 0, verifiable = 0;
-       const char* desc [] = {
-               "Ok", "Error", "Warning", NULL, "CLS", NULL, NULL, NULL, "Not Verifiable"
-       };
-
-       if (verify_code) { /* verify code */
-               int i;
-               MonoTableInfo *m = &image->tables [MONO_TABLE_METHOD];
-
-               for (i = 0; i < m->rows; ++i) {
-                       MonoMethod *method;
-                       MonoError error;
-
-                       method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i+1), NULL, NULL, &error);
-                       if (!method) {
-                               g_print ("Warning: Cannot lookup method with token 0x%08x due to %s\n", i + 1, mono_error_get_message (&error));
-                               mono_error_cleanup (&error);
-                               continue;
-                       }
-                       errors = mono_method_verify (method, flags);
-                       if (errors) {
-                               MonoClass *klass = mono_method_get_class (method);
-                               char *name = mono_type_full_name (&klass->byval_arg);
-                               if (mono_method_signature (method) == NULL) {
-                                       g_print ("In method: %s::%s(ERROR)\n", name, mono_method_get_name (method));
-                               } else {
-                                       char *sig;
-                                       sig = mono_signature_get_desc (mono_method_signature (method), FALSE);  
-                                       g_print ("In method: %s::%s(%s)\n", name, mono_method_get_name (method), sig);
-                                       g_free (sig);
-                               }
-                               g_free (name);
-                       }
-
-                       for (tmp = errors; tmp; tmp = tmp->next) {
-                               MonoVerifyInfo *info = (MonoVerifyInfo *)tmp->data;
-                               g_print ("%s: %s\n", desc [info->status], info->message);
-                               if (info->status == MONO_VERIFY_ERROR) {
-                                       count++;
-                                       verifiable = 3;
-                               }
-                               if(info->status == MONO_VERIFY_NOT_VERIFIABLE) {
-                                       if (verifiable < 2)
-                                               verifiable = 2; 
-                               }
-                       }
-                       mono_free_verify_list (errors);
-               }
-       }
-
-       if (count)
-               g_print ("Error count: %d\n", count);
-       return verifiable;
-}
-
-static void
-usage (void)
-{
-       printf ("Usage is: pedump [--verify error,warn,cls,all,code,fail-on-verifiable,non-strict,valid-only,metadata] file.exe\n");
-       exit (1);
-}
-
-static int
-verify_image_file (const char *fname)
-{
-       GSList *errors = NULL, *tmp;
-       MonoImage *image;
-       MonoTableInfo *table;
-       MonoAssembly *assembly;
-       MonoImageOpenStatus status;
-       int i, count = 0;
-       const char* desc [] = {
-               "Ok", "Error", "Warning", NULL, "CLS", NULL, NULL, NULL, "Not Verifiable"
-       };
-
-       image = mono_image_open_raw (fname, &status);
-       if (!image) {
-               printf ("Could not open %s\n", fname);
-               return 1;
-       }
-
-       if (!mono_verifier_verify_pe_data (image, &errors))
-               goto invalid_image;
-
-       if (!mono_image_load_pe_data (image)) {
-               printf ("Could not load pe data for assembly %s\n", fname);
-               return 1;
-       }
-
-       if (!mono_verifier_verify_cli_data (image, &errors))
-               goto invalid_image;
-
-       if (!mono_image_load_cli_data (image)) {
-               printf ("Could not load cli data for assembly %s\n", fname);
-               return 1;
-       }
-
-       if (!mono_verifier_verify_table_data (image, &errors))
-               goto invalid_image;
-
-       mono_image_load_names (image);
-
-       /*fake an assembly for class loading to work*/
-       assembly = g_new0 (MonoAssembly, 1);
-       assembly->in_gac = FALSE;
-       assembly->image = image;
-       image->assembly = assembly;
-       mono_assembly_fill_assembly_name (image, &assembly->aname);
-
-       /*Finish initializing the runtime*/
-       mono_install_assembly_load_hook (pedump_assembly_load_hook, NULL);
-       mono_install_assembly_search_hook (pedump_assembly_search_hook, NULL);
-
-       mono_init_version ("pedump", image->version);
-
-       mono_install_assembly_preload_hook (pedump_preload, GUINT_TO_POINTER (FALSE));
-
-       mono_icall_init ();
-       mono_marshal_init ();
-
-
-       if (!verify_partial_md && !mono_verifier_verify_full_table_data (image, &errors))
-               goto invalid_image;
-
-
-       table = &image->tables [MONO_TABLE_TYPEDEF];
-       for (i = 1; i <= table->rows; ++i) {
-               MonoError error;
-               guint32 token = i | MONO_TOKEN_TYPE_DEF;
-               MonoClass *klass = mono_class_get_checked (image, token, &error);
-               if (!klass) {
-                       printf ("Could not load class with token %x due to %s\n", token, mono_error_get_message (&error));
-                       mono_error_cleanup (&error);
-                       continue;
-               }
-               mono_class_init (klass);
-               if (mono_class_has_failure (klass)) {
-                       printf ("Error verifying class(0x%08x) %s.%s a type load error happened\n", token, klass->name_space, klass->name);
-                       ++count;
-               }
-
-               mono_class_setup_vtable (klass);
-               if (mono_class_has_failure (klass)) {
-                       printf ("Error verifying class(0x%08x) %s.%s a type load error happened\n", token, klass->name_space, klass->name);
-                       ++count;
-               }
-       }
-       if (count)
-               return 5;
-       return 0;
-
-invalid_image:
-       for (tmp = errors; tmp; tmp = tmp->next) {
-               MonoVerifyInfo *info = (MonoVerifyInfo *)tmp->data;
-               g_print ("%s: %s\n", desc [info->status], info->message);
-               if (info->status == MONO_VERIFY_ERROR)
-                       count++;
-       }
-       mono_free_verify_list (errors);
-       if (count)
-               g_print ("Error count: %d\n", count);
-       return 1;
-}
-
-static gboolean
-try_load_from (MonoAssembly **assembly, const gchar *path1, const gchar *path2,
-                                       const gchar *path3, const gchar *path4, gboolean refonly)
-{
-       gchar *fullpath;
-
-       *assembly = NULL;
-       fullpath = g_build_filename (path1, path2, path3, path4, NULL);
-       if (g_file_test (fullpath, G_FILE_TEST_IS_REGULAR))
-               *assembly = mono_assembly_open_full (fullpath, NULL, refonly);
-
-       g_free (fullpath);
-       return (*assembly != NULL);
-}
-
-static MonoAssembly *
-real_load (gchar **search_path, const gchar *culture, const gchar *name, gboolean refonly)
-{
-       MonoAssembly *result = NULL;
-       gchar **path;
-       gchar *filename;
-       const gchar *local_culture;
-       gint len;
-
-       if (!culture || *culture == '\0') {
-               local_culture = "";
-       } else {
-               local_culture = culture;
-       }
-
-       filename =  g_strconcat (name, ".dll", NULL);
-       len = strlen (filename);
-
-       for (path = search_path; *path; path++) {
-               if (**path == '\0')
-                       continue; /* Ignore empty ApplicationBase */
-
-               /* See test cases in bug #58992 and bug #57710 */
-               /* 1st try: [culture]/[name].dll (culture may be empty) */
-               strcpy (filename + len - 4, ".dll");
-               if (try_load_from (&result, *path, local_culture, "", filename, refonly))
-                       break;
-
-               /* 2nd try: [culture]/[name].exe (culture may be empty) */
-               strcpy (filename + len - 4, ".exe");
-               if (try_load_from (&result, *path, local_culture, "", filename, refonly))
-                       break;
-
-               /* 3rd try: [culture]/[name]/[name].dll (culture may be empty) */
-               strcpy (filename + len - 4, ".dll");
-               if (try_load_from (&result, *path, local_culture, name, filename, refonly))
-                       break;
-
-               /* 4th try: [culture]/[name]/[name].exe (culture may be empty) */
-               strcpy (filename + len - 4, ".exe");
-               if (try_load_from (&result, *path, local_culture, name, filename, refonly))
-                       break;
-       }
-
-       g_free (filename);
-       return result;
-}
-
-/*
- * Try to load referenced assemblies from assemblies_path.
- */
-static MonoAssembly *
-pedump_preload (MonoAssemblyName *aname,
-                                gchar **assemblies_path,
-                                gpointer user_data)
-{
-       MonoAssembly *result = NULL;
-       gboolean refonly = GPOINTER_TO_UINT (user_data);
-
-       if (assemblies_path && assemblies_path [0] != NULL) {
-               result = real_load (assemblies_path, aname->culture, aname->name, refonly);
-       }
-
-       return result;
-}
-
-static GList *loaded_assemblies = NULL;
-
-static void
-pedump_assembly_load_hook (MonoAssembly *assembly, gpointer user_data)
-{
-       loaded_assemblies = g_list_prepend (loaded_assemblies, assembly);
-}
-
-static MonoAssembly *
-pedump_assembly_search_hook (MonoAssemblyName *aname, gpointer user_data)
-{
-        GList *tmp;
-
-       for (tmp = loaded_assemblies; tmp; tmp = tmp->next) {
-               MonoAssembly *ass = (MonoAssembly *)tmp->data;
-               if (mono_assembly_names_equal (aname, &ass->aname))
-                      return ass;
-       }
-       return NULL;
-}
-
-#define VALID_ONLY_FLAG 0x08000000
-#define VERIFY_CODE_ONLY MONO_VERIFY_ALL + 1 
-#define VERIFY_METADATA_ONLY VERIFY_CODE_ONLY + 1
-#define VERIFY_PARTIAL_METADATA VERIFY_CODE_ONLY + 2
-
-int
-main (int argc, char *argv [])
-{
-       int image_result = 0;
-       MonoImage *image;
-       char *file = NULL;
-       char *flags = NULL;
-       MiniVerifierMode verifier_mode = MONO_VERIFIER_MODE_VERIFIABLE;
-       const char *flag_desc [] = {"error", "warn", "cls", "all", "code", "fail-on-verifiable", "non-strict", "valid-only", "metadata", "partial-md", NULL};
-       guint flag_vals [] = {MONO_VERIFY_ERROR, MONO_VERIFY_WARNING, MONO_VERIFY_CLS, MONO_VERIFY_ALL, VERIFY_CODE_ONLY, MONO_VERIFY_FAIL_FAST, MONO_VERIFY_NON_STRICT, VALID_ONLY_FLAG, VERIFY_METADATA_ONLY, VERIFY_PARTIAL_METADATA, 0};
-       int i, verify_flags = MONO_VERIFY_REPORT_ALL_ERRORS, run_new_metadata_verifier = 0;
-       
-       for (i = 1; i < argc; i++){
-               if (argv [i][0] != '-'){
-                       file = argv [i];
-                       continue;
-               }
-
-               if (strcmp (argv [i], "--help") == 0)
-                       usage ();
-               else if (strcmp (argv [i], "--verify") == 0) {
-                       verify_pe = 1;
-                       dump_data = 0;
-                       ++i;
-                       flags = argv [i];
-               } else {
-                       usage ();
-               }
-       }
-       
-       if (!file)
-               usage ();
-
-#ifndef DISABLE_PERFCOUNTERS
-       mono_perfcounters_init ();
-#endif
-       mono_counters_init ();
-       mono_metadata_init ();
-       mono_images_init ();
-       mono_assemblies_init ();
-       mono_loader_init ();
-       if (verify_pe) {
-               char *tok = strtok (flags, ",");
-
-               verify_metadata = 1;
-               verify_code = 0;
-               while (tok) {
-                       for (i = 0; flag_desc [i]; ++i) {
-                               if (strcmp (tok, flag_desc [i]) == 0) {
-                                       if (flag_vals [i] == VERIFY_CODE_ONLY) {
-                                               verify_metadata = 0;
-                                               verify_code = 1;
-                                       } else if(flag_vals [i] == MONO_VERIFY_ALL) {
-                                               verify_code = 1;
-                                       } else if(flag_vals [i] == VERIFY_METADATA_ONLY) {
-                                               verify_metadata = 0;
-                                               run_new_metadata_verifier = 1;
-                                       } else if(flag_vals [i] == VERIFY_PARTIAL_METADATA) {
-                                               verify_partial_md = 1;
-                                       }
-                                       if (flag_vals [i] == VALID_ONLY_FLAG)
-                                               verifier_mode = MONO_VERIFIER_MODE_VALID;
-                                       else
-                                               verify_flags |= flag_vals [i];
-                                       break;
-                               }
-                       }
-                       if (!flag_desc [i])
-                               g_print ("Unknown verify flag %s\n", tok);
-                       tok = strtok (NULL, ",");
-               }
-
-               mono_verifier_set_mode (verifier_mode);
-               /**/
-       }
-
-       if (verify_pe || run_new_metadata_verifier) {
-               run_new_metadata_verifier = 1;
-       }
-       
-       if (run_new_metadata_verifier) {
-               mono_verifier_set_mode (verifier_mode);
-
-               image_result = verify_image_file (file);
-               if (image_result == 1 || !verify_code)
-                       return image_result;
-       }
-
-       image = mono_image_open (file, NULL);
-       if (!image){
-               fprintf (stderr, "Cannot open image %s\n", file);
-               exit (1);
-       }
-
-       if (dump_data)
-               dump_dotnet_iinfo (image);
-       if (verify_pe) {
-               MonoAssembly *assembly;
-               MonoImage *image;
-               MonoImageOpenStatus status;
-               int code_result;
-
-               mono_verifier_set_mode (verifier_mode);
-
-               assembly = mono_assembly_open (file, NULL);
-               /*fake an assembly for netmodules so the verifier works*/
-               if (!assembly && (image = mono_image_open (file, &status)) && image->tables [MONO_TABLE_ASSEMBLY].rows == 0) {
-                       assembly = g_new0 (MonoAssembly, 1);
-                       assembly->in_gac = FALSE;
-                       assembly->image = image;
-                       image->assembly = assembly;
-               }
-
-               if (!assembly) {
-                       g_print ("Could not open assembly %s\n", file);
-                       return 4;
-               }
-
-               code_result = dump_verify_info (assembly->image, verify_flags);
-               return code_result ? code_result : image_result;
-       } else
-               mono_image_close (image);
-       
-       return 0;
-}
-
index 944bde7f63c15798bbc280a9489d9fe8bd927fe2..bccc7d8aad53fa1b91dfb139a10df911b6132c13 100644 (file)
@@ -841,7 +841,7 @@ mono_gc_clear_domain (MonoDomain * domain)
        sgen_stop_world (0);
 
        if (sgen_concurrent_collection_in_progress ())
-               sgen_perform_collection (0, GENERATION_OLD, "clear domain", TRUE);
+               sgen_perform_collection (0, GENERATION_OLD, "clear domain", TRUE, FALSE);
        SGEN_ASSERT (0, !sgen_concurrent_collection_in_progress (), "We just ordered a synchronous collection.  Why are we collecting concurrently?");
 
        major_collector.finish_sweeping ();
@@ -1330,6 +1330,18 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
 
        mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
        mono_mb_emit_byte (mb, CEE_MONO_NOT_TAKEN);
+       /*
+        * We are no longer in a critical section. We need to do this before calling
+        * to unmanaged land in order to avoid stw deadlocks since unmanaged code
+        * might take locks.
+        */
+#ifdef MANAGED_ALLOCATOR_CAN_USE_CRITICAL_REGION
+       EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR (mb, thread_var);
+       mono_mb_emit_byte (mb, CEE_LDC_I4_0);
+       mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
+       mono_mb_emit_byte (mb, CEE_MONO_ATOMIC_STORE_I4);
+       mono_mb_emit_i4 (mb, MONO_MEMORY_BARRIER_NONE);
+#endif
 
        /* FIXME: mono_gc_alloc_obj takes a 'size_t' as an argument, not an int32 */
        mono_mb_emit_ldarg (mb, 0);
@@ -2522,7 +2534,11 @@ mono_gc_get_gc_name (void)
 char*
 mono_gc_get_description (void)
 {
+#ifdef HAVE_CONC_GC_AS_DEFAULT
+       return g_strdup ("sgen (concurrent by default)");
+#else
        return g_strdup ("sgen");
+#endif
 }
 
 void
index ae1268c15222bb42c823274af45d475740a2dc0d..95bac2301bd8b5f9d0dc20e5adb70b777ebf1faf 100644 (file)
@@ -2832,12 +2832,17 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *
 }
 
 gboolean
-ves_icall_System_Net_Sockets_Socket_SupportPortReuse (void)
+ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto)
 {
 #if defined (SO_REUSEPORT) || defined (HOST_WIN32)
-    return TRUE;
+       return TRUE;
 #else
-    return FALSE;
+#ifdef __linux__
+       /* Linux always supports double binding for UDP, even on older kernels. */
+       if (proto == ProtocolType_Udp)
+               return TRUE;
+#endif
+       return FALSE;
 #endif
 }
 
index 138cc674d5b0f46410add6da353ae36c79a57deb..e228f0a2e63df038682a3d004622f541cf928284 100644 (file)
@@ -189,7 +189,7 @@ extern MonoBoolean ves_icall_System_Net_Sockets_Socket_Poll_internal (SOCKET soc
 extern void ves_icall_System_Net_Sockets_Socket_Disconnect_internal(SOCKET sock, MonoBoolean reuse, gint32 *error);
 extern gboolean ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags);
 void icall_cancel_blocking_socket_operation (MonoThread *thread);
-extern gboolean ves_icall_System_Net_Sockets_Socket_SupportPortReuse (void);
+extern gboolean ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto);
 
 extern void mono_network_init(void);
 extern void mono_network_cleanup(void);
index d5ad79f294259422c75618067790f8b8c1effb9c..518834de3b4867000a5fd3ba6b0fb1fc668d8faf 100644 (file)
@@ -1029,11 +1029,7 @@ mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[
                MonoObject *exc = NULL;
                int res;
 
-               res = mono_runtime_try_run_main (method, argc, argv, &exc, &error);
-               if (exc == NULL && !is_ok (&error))
-                       exc = (MonoObject*) mono_error_convert_to_exception (&error);
-               else
-                       mono_error_cleanup (&error);
+               res = mono_runtime_try_run_main (method, argc, argv, &exc);
                if (exc) {
                        mono_unhandled_exception (exc);
                        mono_invoke_unhandled_exception_hook (exc);
index b0ca01954dd0902a91f25a02e4eda756f68fef2d..c7f1e40b9cd027a6bde28ed8c89b82997e7eff64 100644 (file)
@@ -4470,14 +4470,19 @@ icall_is_direct_callable (MonoCompile *cfg, MonoMethod *cmethod)
 
 #define is_complex_isinst(klass) ((klass->flags & TYPE_ATTRIBUTE_INTERFACE) || klass->rank || mono_class_is_nullable (klass) || mono_class_is_marshalbyref (klass) || (klass->flags & TYPE_ATTRIBUTE_SEALED) || klass->byval_arg.type == MONO_TYPE_VAR || klass->byval_arg.type == MONO_TYPE_MVAR)
 
+static MonoInst*
+emit_isinst_with_cache (MonoCompile *cfg, MonoClass *klass, MonoInst **args)
+{
+       MonoMethod *mono_isinst = mono_marshal_get_isinst_with_cache ();
+       return mono_emit_method_call (cfg, mono_isinst, args, NULL);
+}
+
 static MonoInst*
 emit_castclass_with_cache (MonoCompile *cfg, MonoClass *klass, MonoInst **args)
 {
-       MonoMethod *mono_castclass;
+       MonoMethod *mono_castclass = mono_marshal_get_castclass_with_cache ();
        MonoInst *res;
 
-       mono_castclass = mono_marshal_get_castclass_with_cache ();
-
        save_cast_details (cfg, klass, args [0]->dreg, TRUE);
        res = mono_emit_method_call (cfg, mono_castclass, args, NULL);
        reset_cast_details (cfg);
@@ -4493,6 +4498,22 @@ get_castclass_cache_idx (MonoCompile *cfg)
        return (cfg->method_index << 16) | cfg->castclass_cache_index;
 }
 
+
+static MonoInst*
+emit_isinst_with_cache_nonshared (MonoCompile *cfg, MonoInst *obj, MonoClass *klass)
+{
+       MonoInst *args [3];
+       int idx;
+
+       args [0] = obj; /* obj */
+       EMIT_NEW_CLASSCONST (cfg, args [1], klass); /* klass */
+
+       idx = get_castclass_cache_idx (cfg); /* inline cache*/
+       args [2] = emit_runtime_constant (cfg, MONO_PATCH_INFO_CASTCLASS_CACHE, GINT_TO_POINTER (idx));
+
+       return emit_isinst_with_cache (cfg, klass, args);
+}
+
 static MonoInst*
 emit_castclass_with_cache_nonshared (MonoCompile *cfg, MonoInst *obj, MonoClass *klass)
 {
@@ -4517,45 +4538,16 @@ emit_castclass_with_cache_nonshared (MonoCompile *cfg, MonoInst *obj, MonoClass
  * Returns NULL and set the cfg exception on error.
  */
 static MonoInst*
-handle_castclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src, guint8 *ip, int *inline_costs)
+handle_castclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context_used)
 {
        MonoBasicBlock *is_null_bb;
        int obj_reg = src->dreg;
        int vtable_reg = alloc_preg (cfg);
-       int context_used;
-       MonoInst *klass_inst = NULL, *res;
+       MonoInst *klass_inst = NULL;
 
        if (src->opcode == OP_PCONST && src->inst_p0 == 0)
                return src;
 
-       context_used = mini_class_check_context_used (cfg, klass);
-
-       if (!context_used && mini_class_has_reference_variant_generic_argument (cfg, klass, context_used)) {
-               res = emit_castclass_with_cache_nonshared (cfg, src, klass);
-               (*inline_costs) += 2;
-               return res;
-       } else if (!context_used && (mono_class_is_marshalbyref (klass) || klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
-               MonoMethod *mono_castclass;
-               MonoInst *iargs [1];
-               int costs;
-
-               mono_castclass = mono_marshal_get_castclass (klass); 
-               iargs [0] = src;
-                               
-               save_cast_details (cfg, klass, src->dreg, TRUE);
-               costs = inline_method (cfg, mono_castclass, mono_method_signature (mono_castclass), 
-                                                          iargs, ip, cfg->real_offset, TRUE);
-               reset_cast_details (cfg);
-               CHECK_CFG_EXCEPTION;
-               g_assert (costs > 0);
-                               
-               cfg->real_offset += 5;
-
-               (*inline_costs) += costs;
-
-               return src;
-       }
-
        if (context_used) {
                MonoInst *args [3];
 
@@ -4620,9 +4612,6 @@ handle_castclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src, guint8 *ip,
        reset_cast_details (cfg);
 
        return src;
-
-exception_exit:
-       return NULL;
 }
 
 /*
@@ -4642,21 +4631,15 @@ handle_isinst (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context_us
                MonoInst *args [3];
 
                if(mini_class_has_reference_variant_generic_argument (cfg, klass, context_used) || is_complex_isinst (klass)) {
-                       MonoMethod *mono_isinst = mono_marshal_get_isinst_with_cache ();
-                       MonoInst *cache_ins;
+                       MonoInst *cache_ins = emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_CAST_CACHE);
 
-                       cache_ins = emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_CAST_CACHE);
-
-                       /* obj */
-                       args [0] = src;
+                       args [0] = src; /* obj */
 
                        /* klass - it's the second element of the cache entry*/
                        EMIT_NEW_LOAD_MEMBASE (cfg, args [1], OP_LOAD_MEMBASE, alloc_preg (cfg), cache_ins->dreg, sizeof (gpointer));
 
-                       /* cache */
-                       args [2] = cache_ins;
-
-                       return mono_emit_method_call (cfg, mono_isinst, args, NULL);
+                       args [2] = cache_ins; /* cache */
+                       return emit_isinst_with_cache (cfg, klass, args);
                }
 
                klass_inst = emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_KLASS);
@@ -10958,21 +10941,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        break;
                }
                case CEE_CASTCLASS:
-                       CHECK_STACK (1);
-                       --sp;
-                       CHECK_OPSIZE (5);
-                       token = read32 (ip + 1);
-                       klass = mini_get_class (method, token, generic_context);
-                       CHECK_TYPELOAD (klass);
-                       if (sp [0]->type != STACK_OBJ)
-                               UNVERIFIED;
-
-                       ins = handle_castclass (cfg, klass, *sp, ip, &inline_costs);
-                       CHECK_CFG_EXCEPTION;
-
-                       *sp ++ = ins;
-                       ip += 5;
-                       break;
                case CEE_ISINST: {
                        CHECK_STACK (1);
                        --sp;
@@ -10982,53 +10950,19 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        CHECK_TYPELOAD (klass);
                        if (sp [0]->type != STACK_OBJ)
                                UNVERIFIED;
-                       context_used = mini_class_check_context_used (cfg, klass);
-
-                       if (!context_used && mini_class_has_reference_variant_generic_argument (cfg, klass, context_used)) {
-                               MonoMethod *mono_isinst = mono_marshal_get_isinst_with_cache ();
-                               MonoInst *args [3];
-                               int idx;
-
-                               /* obj */
-                               args [0] = *sp;
-
-                               /* klass */
-                               EMIT_NEW_CLASSCONST (cfg, args [1], klass);
-
-                               /* inline cache*/
-                               idx = get_castclass_cache_idx (cfg);
-                               args [2] = emit_runtime_constant (cfg, MONO_PATCH_INFO_CASTCLASS_CACHE, GINT_TO_POINTER (idx));
-
-                               *sp++ = mono_emit_method_call (cfg, mono_isinst, args, NULL);
-                               ip += 5;
-                               inline_costs += 2;
-                       } else if (!context_used && (mono_class_is_marshalbyref (klass) || klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
-                               MonoMethod *mono_isinst;
-                               MonoInst *iargs [1];
-                               int costs;
-
-                               mono_isinst = mono_marshal_get_isinst (klass); 
-                               iargs [0] = sp [0];
 
-                               costs = inline_method (cfg, mono_isinst, mono_method_signature (mono_isinst), 
-                                                                          iargs, ip, cfg->real_offset, TRUE);
-                               CHECK_CFG_EXCEPTION;
-                               g_assert (costs > 0);
-                               
-                               ip += 5;
-                               cfg->real_offset += 5;
+                       MONO_INST_NEW (cfg, ins, *ip == CEE_ISINST ? OP_ISINST : OP_CASTCLASS);
+                       ins->dreg = alloc_preg (cfg);
+                       ins->sreg1 = (*sp)->dreg;
+                       ins->klass = klass;
+                       ins->type = STACK_OBJ;
+                       MONO_ADD_INS (cfg->cbb, ins);
 
-                               *sp++= iargs [0];
+                       CHECK_CFG_EXCEPTION;
+                       *sp++ = ins;
+                       ip += 5;
 
-                               inline_costs += costs;
-                       }
-                       else {
-                               ins = handle_isinst (cfg, klass, *sp, context_used);
-                               CHECK_CFG_EXCEPTION;
-                               *sp ++ = ins;
-                               ip += 5;
-                       }
+                       cfg->flags |= MONO_CFG_HAS_TYPE_CHECK;
                        break;
                }
                case CEE_UNBOX_ANY: {
@@ -11049,8 +10983,13 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                res = handle_unbox_gsharedvt (cfg, klass, *sp);
                                inline_costs += 2;
                        } else if (generic_class_is_reference_type (cfg, klass)) {
-                               res = handle_castclass (cfg, klass, *sp, ip, &inline_costs);
-                               CHECK_CFG_EXCEPTION;
+                               MONO_INST_NEW (cfg, res, OP_CASTCLASS);
+                               res->dreg = alloc_preg (cfg);
+                               res->sreg1 = (*sp)->dreg;
+                               res->klass = klass;
+                               res->type = STACK_OBJ;
+                               MONO_ADD_INS (cfg->cbb, res);
+                               cfg->flags |= MONO_CFG_HAS_TYPE_CHECK;
                        } else if (mono_class_is_nullable (klass)) {
                                res = handle_unbox_nullable (cfg, *sp, klass, context_used);
                        } else {
@@ -15052,6 +14991,72 @@ mono_spill_global_vars (MonoCompile *cfg, gboolean *need_local_opts)
        g_free (live_range_end_bb);
 }
 
+static void mono_decompose_typecheck (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins)
+{
+       MonoInst *ret, *move, *source;
+       MonoClass *klass = ins->klass;
+       int context_used = mini_class_check_context_used (cfg, klass);
+       int is_isinst = ins->opcode == OP_ISINST;
+       g_assert (is_isinst || ins->opcode == OP_CASTCLASS);
+       source = get_vreg_to_inst (cfg, ins->sreg1);
+       if (!source || source == (MonoInst *) -1)
+               source = mono_compile_create_var_for_vreg (cfg, &mono_defaults.object_class->byval_arg, OP_LOCAL, ins->sreg1);
+       g_assert (source && source != (MonoInst *) -1);
+
+       MonoBasicBlock *first_bb;
+       NEW_BBLOCK (cfg, first_bb);
+       cfg->cbb = first_bb;
+
+       if (!context_used && mini_class_has_reference_variant_generic_argument (cfg, klass, context_used)) {
+               if (is_isinst)
+                       ret = emit_isinst_with_cache_nonshared (cfg, source, klass);
+               else
+                       ret = emit_castclass_with_cache_nonshared (cfg, source, klass);
+       } else if (!context_used && (mono_class_is_marshalbyref (klass) || klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
+               MonoInst *iargs [1];
+               int costs;
+
+               iargs [0] = source;
+               if (is_isinst) {
+                       MonoMethod *wrapper = mono_marshal_get_isinst (klass);
+                       costs = inline_method (cfg, wrapper, mono_method_signature (wrapper), iargs, 0, 0, TRUE);
+               } else {
+                       MonoMethod *wrapper = mono_marshal_get_castclass (klass);
+                       save_cast_details (cfg, klass, source->dreg, TRUE);
+                       costs = inline_method (cfg, wrapper, mono_method_signature (wrapper), iargs, 0, 0, TRUE);
+                       reset_cast_details (cfg);
+               }
+               g_assert (costs > 0);
+               ret = iargs [0];
+       } else {
+               if (is_isinst)
+                       ret = handle_isinst (cfg, klass, source, context_used);
+               else
+                       ret = handle_castclass (cfg, klass, source, context_used);
+       }
+       EMIT_NEW_UNALU (cfg, move, OP_MOVE, ins->dreg, ret->dreg);
+
+       g_assert (cfg->cbb->code || first_bb->code);
+       MonoInst *prev = ins->prev;
+       mono_replace_ins (cfg, bb, ins, &prev, first_bb, cfg->cbb);
+}
+
+void mono_decompose_typechecks (MonoCompile *cfg)
+{
+       for (MonoBasicBlock *bb = cfg->bb_entry; bb; bb = bb->next_bb) {
+               MonoInst *c;
+               MONO_BB_FOR_EACH_INS (bb, c) {
+                       switch (c->opcode) {
+                       case OP_ISINST:
+                       case OP_CASTCLASS:
+                               mono_decompose_typecheck (cfg, bb, c);
+                               break;
+                       }
+               }
+       }
+}
+
+
 /**
  * FIXME:
  * - use 'iadd' instead of 'int_add'
index 3e59c9da16d42fd0f6aae2165428f3ff2ba3d523..9087f1ddbf69cf5e3e32c2a9ff72405e858b7f43 100644 (file)
@@ -392,6 +392,17 @@ add_valuetype_win64 (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
 
        klass = mono_class_from_mono_type (type);
        size = mini_type_stack_size_full (&klass->byval_arg, NULL, sig->pinvoke);
+
+       /*
+       * Standard C and C++ doesn't allow empty structs, empty structs will always have a size of 1 byte.
+       * GCC have an extension to allow empty structs, https://gcc.gnu.org/onlinedocs/gcc/Empty-Structures.html.
+       * This cause a little dilemma since runtime build using none GCC compiler will not be compatible with
+       * GCC build C libraries and the other way around. On platforms where empty structs has size of 1 byte
+       * it must be represented in call and cannot be dropped.
+       */
+       if (0 == size && MONO_TYPE_ISSTRUCT (type) && sig->pinvoke)
+               ainfo->pass_empty_struct = TRUE;
+       
        if (!sig->pinvoke)
                pass_on_stack = TRUE;
 
@@ -448,13 +459,17 @@ add_valuetype_win64 (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
        } else {
                g_assert (info);
 
-               if (!fields) {
+               /*Only drop value type if its not an empty struct as input that must be represented in call*/
+               if ((!fields && !ainfo->pass_empty_struct) || (!fields && ainfo->pass_empty_struct && is_return)) {
                        ainfo->storage = ArgValuetypeInReg;
                        ainfo->pair_storage [0] = ainfo->pair_storage [1] = ArgNone;
                        return;
                }
 
                switch (info->native_size) {
+               case 0:
+                       g_assert (!fields && MONO_TYPE_ISSTRUCT (type) && !is_return);
+                       break;
                case 1: case 2: case 4: case 8:
                        break;
                default:
@@ -487,7 +502,11 @@ add_valuetype_win64 (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
                guint32 align;
                ArgumentClass class1;
 
-               if (nfields == 0)
+               if (nfields == 0 && ainfo->pass_empty_struct) {
+                       g_assert (!fields && !is_return);
+                       class1 = ARG_CLASS_INTEGER;
+               }
+               else if (nfields == 0)
                        class1 = ARG_CLASS_MEMORY;
                else
                        class1 = ARG_CLASS_NO_CLASS;
@@ -586,6 +605,7 @@ add_valuetype (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
 
        klass = mono_class_from_mono_type (type);
        size = mini_type_stack_size_full (&klass->byval_arg, NULL, sig->pinvoke);
+
        if (!sig->pinvoke && ((is_return && (size == 8)) || (!is_return && (size <= 16)))) {
                /* We pass and return vtypes of size 8 in a register */
        } else if (!sig->pinvoke || (size == 0) || (size > 16)) {
@@ -1937,6 +1957,7 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig)
                        t = sig->params [i - sig->hasthis];
                else
                        t = &mono_defaults.int_class->byval_arg;
+               t = mini_type_get_underlying_type (t);
 
                linfo->args [i].storage = LLVMArgNone;
 
@@ -2112,7 +2133,7 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
                                /* Continue normally */
                        }
 
-                       if (size > 0) {
+                       if (size > 0 || ainfo->pass_empty_struct) {
                                MONO_INST_NEW (cfg, arg, OP_OUTARG_VT);
                                arg->sreg1 = in->dreg;
                                arg->klass = mono_class_from_mono_type (t);
@@ -2210,21 +2231,28 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src)
                        if (ainfo->pair_storage [part] == ArgNone)
                                continue;
 
-                       MONO_INST_NEW (cfg, load, arg_storage_to_load_membase (ainfo->pair_storage [part]));
-                       load->inst_basereg = src->dreg;
-                       load->inst_offset = part * sizeof(mgreg_t);
+                       if (ainfo->pass_empty_struct) {
+                               //Pass empty struct value as 0 on platforms representing empty structs as 1 byte.
+                               NEW_ICONST (cfg, load, 0);
+                       }
+                       else {
+                               MONO_INST_NEW (cfg, load, arg_storage_to_load_membase (ainfo->pair_storage [part]));
+                               load->inst_basereg = src->dreg;
+                               load->inst_offset = part * sizeof(mgreg_t);
 
-                       switch (ainfo->pair_storage [part]) {
-                       case ArgInIReg:
-                               load->dreg = mono_alloc_ireg (cfg);
-                               break;
-                       case ArgInDoubleSSEReg:
-                       case ArgInFloatSSEReg:
-                               load->dreg = mono_alloc_freg (cfg);
-                               break;
-                       default:
-                               g_assert_not_reached ();
+                               switch (ainfo->pair_storage [part]) {
+                               case ArgInIReg:
+                                       load->dreg = mono_alloc_ireg (cfg);
+                                       break;
+                               case ArgInDoubleSSEReg:
+                               case ArgInFloatSSEReg:
+                                       load->dreg = mono_alloc_freg (cfg);
+                                       break;
+                               default:
+                                       g_assert_not_reached ();
+                               }
                        }
+
                        MONO_ADD_INS (cfg->cbb, load);
 
                        add_outarg_reg (cfg, call, ainfo->pair_storage [part], ainfo->pair_regs [part], load);
index 68aaf3925464c1d3b7d4b27adef32eafa586d2df..11fc30a435f28b08366bd6cae009fe21602147d4 100644 (file)
@@ -269,6 +269,7 @@ typedef struct {
        int nregs;
        /* Only if storage == ArgOnStack */
        int arg_size; // Bytes, will always be rounded up/aligned to 8 byte boundary
+       gboolean pass_empty_struct; // Set in scenarios when empty structs needs to be represented as argument.
 } ArgInfo;
 
 typedef struct {
index 9cf772bad0815ae9571b4417e494ba63e5de439b..57a7a38deef9f7845a8aaf94024d58955698e06e 100644 (file)
@@ -535,6 +535,10 @@ mono_print_ins_index_strbuf (int i, MonoInst *ins)
                case OP_GSHAREDVT_ARG_REGOFFSET:
                        g_string_append_printf (sbuf, " + 0x%lx", (long)ins->inst_offset);
                        break;
+               case OP_ISINST:
+               case OP_CASTCLASS:
+                       g_string_append_printf (sbuf, " %s", ins->klass->name);
+                       break;
                default:
                        break;
                }
index ca7a3ce12b2ba071c84d3b0c1583c0cc56bf09cc..93dee86723df1fe88855b0770b1e2cc1100141e9 100644 (file)
@@ -2036,7 +2036,10 @@ emit_store_general (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builde
                args [4] = LLVMConstInt (LLVMInt32Type (), ordering, FALSE);
                emit_call (ctx, bb, builder_ref, get_intrinsic (ctx, intrins_name), args, 5);
        } else {
-               mono_llvm_build_store (*builder_ref, value, addr, is_faulting, barrier);
+               if (barrier != LLVM_BARRIER_NONE)
+                       mono_llvm_build_aligned_store (*builder_ref, value, addr, barrier, size);
+               else
+                       mono_llvm_build_store (*builder_ref, value, addr, is_faulting, barrier);
        }
 }
 
@@ -5478,9 +5481,6 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                case OP_ATOMIC_STORE_U8:
                case OP_ATOMIC_STORE_R4:
                case OP_ATOMIC_STORE_R8: {
-                       set_failure (ctx, "atomic mono.store intrinsic");
-                       break;
-#if 0
                        int size;
                        gboolean sext, zext;
                        LLVMTypeRef t;
@@ -5488,6 +5488,11 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        BarrierKind barrier = (BarrierKind) ins->backend.memory_barrier_kind;
                        LLVMValueRef index, addr, value;
 
+                       if (!cfg->llvm_only) {
+                               set_failure (ctx, "atomic mono.store intrinsic");
+                               break;
+                       }
+
                        if (!values [ins->inst_destbasereg]) {
                            set_failure (ctx, "inst_destbasereg");
                                break;
@@ -5501,7 +5506,6 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
 
                        emit_store_general (ctx, bb, &builder, size, value, addr, is_volatile, barrier);
                        break;
-#endif
                }
                case OP_RELAXED_NOP: {
 #if defined(TARGET_AMD64) || defined(TARGET_X86)
index 883fc1af323b2eab7427b492160bef2dda2e8411..4c29d4a0e4dd0e9f5b3be528f88faa68f1be86ba 100644 (file)
@@ -706,6 +706,9 @@ MINI_OP(OP_STRLEN, "strlen", IREG, IREG, NONE)
 MINI_OP(OP_NEWARR, "newarr", IREG, IREG, NONE)
 MINI_OP(OP_LDLEN, "ldlen", IREG, IREG, NONE)
 MINI_OP(OP_BOUNDS_CHECK, "bounds_check", NONE, IREG, IREG)
+/* type checks */
+MINI_OP(OP_ISINST, "isinst", IREG, IREG, NONE)
+MINI_OP(OP_CASTCLASS, "castclass", IREG, IREG, NONE)
 /* get adress of element in a 2D array */
 MINI_OP(OP_LDELEMA2D, "getldelema2", NONE, NONE, NONE)
 /* inlined small memcpy with constant length */
index 6f4082905c5687bf4679fffe2550815663475880..ee5a2920156b495ca71d1fd702d633ebd315f61d 100644 (file)
@@ -3254,6 +3254,7 @@ register_jit_stats (void)
        mono_counters_register ("JIT/liveness_handle_exception_clauses (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_liveness_handle_exception_clauses);
        mono_counters_register ("JIT/handle_out_of_line_bblock (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_handle_out_of_line_bblock);
        mono_counters_register ("JIT/decompose_long_opts (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_decompose_long_opts);
+       mono_counters_register ("JIT/decompose_typechecks (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_decompose_typechecks);
        mono_counters_register ("JIT/local_cprop (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_local_cprop);
        mono_counters_register ("JIT/local_emulate_ops (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_local_emulate_ops);
        mono_counters_register ("JIT/optimize_branches (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_optimize_branches);
index af779644801d323dcd3ca945e6abe73c0aba5ef4..87d58290d812887d0936302d97e708acad7da54a 100644 (file)
@@ -2896,6 +2896,17 @@ is_open_method (MonoMethod *method)
        return FALSE;
 }
 
+static void mono_insert_nop_in_empty_bb (MonoCompile *cfg)
+{
+       MonoBasicBlock *bb;
+       for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
+               if (bb->code)
+                       continue;
+               MonoInst *nop;
+               MONO_INST_NEW (cfg, nop, OP_NOP);
+               MONO_ADD_INS (bb, nop);
+       }
+}
 static void
 mono_create_gc_safepoint (MonoCompile *cfg, MonoBasicBlock *bblock)
 {
@@ -3499,6 +3510,12 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        MONO_TIME_TRACK (mono_jit_stats.jit_method_to_ir, i = mono_method_to_ir (cfg, method_to_compile, NULL, NULL, NULL, NULL, 0, FALSE));
        mono_cfg_dump_ir (cfg, "method-to-ir");
 
+       if (cfg->gdump_ctx != NULL) {
+               /* workaround for graph visualization, as it doesn't handle empty basic blocks properly */
+               mono_insert_nop_in_empty_bb (cfg);
+               mono_cfg_dump_ir (cfg, "mono_insert_nop_in_empty_bb");
+       }
+
        if (i < 0) {
                if (try_generic_shared && cfg->exception_type == MONO_EXCEPTION_GENERIC_SHARING_FAILED) {
                        if (compile_aot) {
@@ -3577,6 +3594,15 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
                mono_cfg_dump_ir (cfg, "local_cprop");
        }
 
+       if (cfg->flags & MONO_CFG_HAS_TYPE_CHECK) {
+               MONO_TIME_TRACK (mono_jit_stats.jit_decompose_typechecks, mono_decompose_typechecks (cfg));
+               if (cfg->gdump_ctx != NULL) {
+                       /* workaround for graph visualization, as it doesn't handle empty basic blocks properly */
+                       mono_insert_nop_in_empty_bb (cfg);
+               }
+               mono_cfg_dump_ir (cfg, "decompose_typechecks");
+       }
+
        /*
         * Should be done after cprop which can do strength reduction on
         * some of these ops, after propagating immediates.
index 48729fc2eeeac4601b3a06e59a30d06c120fabf4..d9ba06ff5225ffcfdc5f2659b6cefc4171b2c0b5 100644 (file)
@@ -478,7 +478,7 @@ enum {
 
 #define MONO_IS_COND_EXC(ins) ((((ins)->opcode >= OP_COND_EXC_EQ) && ((ins)->opcode <= OP_COND_EXC_LT_UN)) || (((ins)->opcode >= OP_COND_EXC_IEQ) && ((ins)->opcode <= OP_COND_EXC_ILT_UN)))
 
-#define MONO_IS_SETCC(ins) ((((ins)->opcode >= OP_CEQ) && ((ins)->opcode <= OP_CLT_UN)) || (((ins)->opcode >= OP_ICEQ) && ((ins)->opcode <= OP_ICLT_UN)) || (((ins)->opcode >= OP_LCEQ) && ((ins)->opcode <= OP_LCLT_UN)) || (((ins)->opcode >= OP_FCEQ) && ((ins)->opcode <= OP_FCLT_UN)))
+#define MONO_IS_SETCC(ins) ((((ins)->opcode >= OP_CEQ) && ((ins)->opcode <= OP_CLT_UN)) || (((ins)->opcode >= OP_ICEQ) && ((ins)->opcode <= OP_ICLE_UN)) || (((ins)->opcode >= OP_LCEQ) && ((ins)->opcode <= OP_LCLT_UN)) || (((ins)->opcode >= OP_FCEQ) && ((ins)->opcode <= OP_FCLT_UN)))
 
 
 #define MONO_IS_LOAD_MEMBASE(ins) (((ins)->opcode >= OP_LOAD_MEMBASE && (ins)->opcode <= OP_LOADV_MEMBASE) || ((ins)->opcode >= OP_ATOMIC_LOAD_I1 && (ins)->opcode <= OP_ATOMIC_LOAD_R8))
@@ -1869,7 +1869,8 @@ typedef enum {
        MONO_CFG_HAS_FPOUT    = 1 << 5, /* there are fp values passed in int registers */
        MONO_CFG_HAS_SPILLUP  = 1 << 6, /* spill var slots are allocated from bottom to top */
        MONO_CFG_HAS_CHECK_THIS  = 1 << 7,
-       MONO_CFG_HAS_ARRAY_ACCESS = 1 << 8
+       MONO_CFG_HAS_ARRAY_ACCESS = 1 << 8,
+       MONO_CFG_HAS_TYPE_CHECK = 1 << 9
 } MonoCompileFlags;
 
 typedef struct {
@@ -1903,6 +1904,7 @@ typedef struct {
        double jit_liveness_handle_exception_clauses;
        double jit_handle_out_of_line_bblock;
        double jit_decompose_long_opts;
+       double jit_decompose_typechecks;
        double jit_local_cprop;
        double jit_local_emulate_ops;
        double jit_optimize_branches;
@@ -2855,6 +2857,7 @@ typedef void  (*MonoUnhandledExceptionFunc)         (MonoObject *exc, gpointer u
 MONO_API void mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, gpointer user_data);
 void          mono_invoke_unhandled_exception_hook  (MonoObject *exc);
 
+void mono_decompose_typechecks (MonoCompile *cfg);
 /* Dominator/SSA methods */
 void        mono_compile_dominator_info         (MonoCompile *cfg, int dom_flags);
 void        mono_compute_natural_loops          (MonoCompile *cfg);
index dcf977c06e1b736e4f46ad3ec4ea9a0d760eb2af..2e9f4666d21675f5a13596ee5bb8d14ecd26c68d 100644 (file)
@@ -96,7 +96,7 @@ alloc_degraded (GCVTable vtable, size_t size, gboolean for_mature)
                sgen_ensure_free_space (size, GENERATION_OLD);
        } else {
                if (sgen_need_major_collection (size))
-                       sgen_perform_collection (size, GENERATION_OLD, "mature allocation failure", !for_mature);
+                       sgen_perform_collection (size, GENERATION_OLD, "mature allocation failure", !for_mature, TRUE);
        }
 
 
@@ -164,7 +164,7 @@ sgen_alloc_obj_nolock (GCVTable vtable, size_t size)
 
                if (collect_before_allocs) {
                        if (((current_alloc % collect_before_allocs) == 0) && nursery_section) {
-                               sgen_perform_collection (0, GENERATION_NURSERY, "collect-before-alloc-triggered", TRUE);
+                               sgen_perform_collection (0, GENERATION_NURSERY, "collect-before-alloc-triggered", TRUE, TRUE);
                                if (!degraded_mode && sgen_can_alloc_size (size) && real_size <= SGEN_MAX_SMALL_OBJ_SIZE) {
                                        // FIXME:
                                        g_assert_not_reached ();
@@ -424,7 +424,7 @@ sgen_alloc_obj (GCVTable vtable, size_t size)
                if (collect_before_allocs) {
                        if (((current_alloc % collect_before_allocs) == 0) && nursery_section) {
                                LOCK_GC;
-                               sgen_perform_collection (0, GENERATION_NURSERY, "collect-before-alloc-triggered", TRUE);
+                               sgen_perform_collection (0, GENERATION_NURSERY, "collect-before-alloc-triggered", TRUE, TRUE);
                                UNLOCK_GC;
                        }
                }
index 75699b7563f5a5152f9d1757d5ed924cb2c0266f..1393ea610e5a0b8783ad741dc894d19d7ed8a417 100644 (file)
@@ -2226,14 +2226,14 @@ sgen_ensure_free_space (size_t size, int generation)
 
        if (generation_to_collect == -1)
                return;
-       sgen_perform_collection (size, generation_to_collect, reason, FALSE);
+       sgen_perform_collection (size, generation_to_collect, reason, FALSE, TRUE);
 }
 
 /*
  * LOCKING: Assumes the GC lock is held.
  */
 void
-sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish)
+sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish, gboolean stw)
 {
        TV_DECLARE (gc_total_start);
        TV_DECLARE (gc_total_end);
@@ -2246,7 +2246,11 @@ sgen_perform_collection (size_t requested_size, int generation_to_collect, const
 
        SGEN_ASSERT (0, generation_to_collect == GENERATION_NURSERY || generation_to_collect == GENERATION_OLD, "What generation is this?");
 
-       sgen_stop_world (generation_to_collect);
+       if (stw)
+               sgen_stop_world (generation_to_collect);
+       else
+               SGEN_ASSERT (0, sgen_is_world_stopped (), "We can only collect if the world is stopped");
+               
 
        TV_GETTIME (gc_total_start);
 
@@ -2306,7 +2310,8 @@ sgen_perform_collection (size_t requested_size, int generation_to_collect, const
        TV_GETTIME (gc_total_end);
        time_max = MAX (time_max, TV_ELAPSED (gc_total_start, gc_total_end));
 
-       sgen_restart_world (oldest_generation_collected);
+       if (stw)
+               sgen_restart_world (oldest_generation_collected);
 }
 
 /*
@@ -2676,7 +2681,7 @@ sgen_gc_collect (int generation)
        LOCK_GC;
        if (generation > 1)
                generation = 1;
-       sgen_perform_collection (0, generation, "user request", TRUE);
+       sgen_perform_collection (0, generation, "user request", TRUE, TRUE);
        UNLOCK_GC;
 }
 
index 9ebd40c0d315c92101c79aea2fa95c00c3c7fbb5..21268a9f8ff71aa0ca7778f33860e6afead99c9d 100644 (file)
@@ -806,7 +806,7 @@ void sgen_set_pinned_from_failed_allocation (mword objsize);
 
 void sgen_ensure_free_space (size_t size, int generation);
 void sgen_gc_collect (int generation);
-void sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish);
+void sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish, gboolean stw);
 
 int sgen_gc_collection_count (int generation);
 /* FIXME: what exactly does this return? */
index f2c646b3952f678b513bd74b6f7667f110ca4a24..4d0c09d40a8514809c32b3ddc4f34cf838751f94 100644 (file)
@@ -713,7 +713,7 @@ major_alloc_small_pinned_obj (GCVTable vtable, size_t size, gboolean has_referen
          *as pinned alloc is requested by the runtime.
          */
         if (!res) {
-               sgen_perform_collection (0, GENERATION_OLD, "pinned alloc failure", TRUE);
+               sgen_perform_collection (0, GENERATION_OLD, "pinned alloc failure", TRUE, TRUE);
                res = alloc_obj (vtable, size, TRUE, has_references);
         }
         return (GCObject *)res;
index b3b5c34c0fd7a4ffd9d3425114d7f759ffa2d8f1..8b5d106bd5321da3236afb01c682d88e075a7218 100644 (file)
@@ -22,6 +22,12 @@ JITTEST_PROG_RUN = MONO_CFG_DIR=$(mono_build_root)/runtime/etc $(LIBTOOL) --mode
 
 RUNTIME_ARGS=--config tests-config --optimize=all --debug
 
+if HOST_WIN32
+TEST_RUNNER_ARGS=--config tests-config --runtime $(if $(MONO_EXECUTABLE),$(shell cygpath -w -a $(MONO_EXECUTABLE) | sed 's/\\/\\\\/g'),mono)
+else
+TEST_RUNNER_ARGS=--config tests-config --runtime $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),mono)
+endif
+
 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
 
 with_mono_path = MONO_PATH=$(CLASS)
@@ -867,11 +873,11 @@ runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQS
 
 runtest-managed: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
        @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
-       $(RUNTIME) --debug ./test-runner.exe -j a --testsuite-name "runtime" --timeout 300 --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
+       $(RUNTIME) --debug ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name "runtime" --timeout 300 --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
 
 runtest-managed-serial: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
        @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
-       $(RUNTIME) --debug ./test-runner.exe -j 1 --testsuite-name "runtime" --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
+       $(RUNTIME) --debug ./test-runner.exe $(TEST_RUNNER_ARGS) -j 1 --testsuite-name "runtime" --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
 
 testjit:
        @if test x$(M) != x0; then $(MAKE) runtest-managed; else $(MAKE) runtest; fi
@@ -990,21 +996,21 @@ sgen-regular-tests: $(SGEN_REGULAR_TESTS)
        $(MAKE) sgen-regular-tests-ms-split-clear-at-gc
 
 sgen-regular-tests-plain: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-split: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-split: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-split-95: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split,alloc-ratio=95" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split,alloc-ratio=95" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-plain-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-split-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 
 SGEN_TOGGLEREF_TESTS=  \
        sgen-toggleref.exe
@@ -1020,21 +1026,21 @@ sgen-toggleref-tests: $(SGEN_TOGGLEREF_TESTS)
        $(MAKE) sgen-toggleref-tests-ms-split-clear-at-gc
 
 sgen-toggleref-tests-plain: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split-95: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split,alloc-ratio=95" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split,alloc-ratio=95" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-plain-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 
 SGEN_BRIDGE_TESTS=     \
        sgen-bridge.exe \
@@ -1051,21 +1057,21 @@ sgen-bridge-tests: $(SGEN_BRIDGE_TESTS)
        $(MAKE) sgen-bridge-tests-ms-split-tarjan-bridge
 
 sgen-bridge-tests-plain: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-conc: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-plain-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-conc-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-plain-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 
 SGEN_BRIDGE2_TESTS=    \
        sgen-bridge-xref.exe
@@ -1081,21 +1087,21 @@ sgen-bridge2-tests: $(SGEN_BRIDGE2_TESTS)
        $(MAKE) sgen-bridge2-tests-ms-split-tarjan-bridge
 
 sgen-bridge2-tests-plain: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-conc: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-plain-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-conc-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-plain-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 
 
 SGEN_BRIDGE3_TESTS=    \
@@ -1350,7 +1356,7 @@ test-generic-sharing-normal: $(GSHARED_TESTS)
        done
 
 test-generic-sharing-managed: test-runner.exe $(GSHARED_TESTS)
-       @$(RUNTIME) ./test-runner.exe -j a --testsuite-name "gshared" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
+       @$(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name "gshared" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
 
 if NACL_CODEGEN
 test-generic-sharing:
@@ -1427,13 +1433,13 @@ test-unhandled-exception-2: $(UNHANDLED_EXCEPTION_1_TESTS) $(UNHANDLED_EXCEPTION
        $(MAKE) test-unhandled-exception-2-255-without-managed-handler
 
 test-unhandled-exception-2-1-with-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
-       $(RUNTIME) ./test-runner.exe -j a --testsuite-name $@ --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
+       $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
 test-unhandled-exception-2-1-without-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
-       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) ./test-runner.exe -j a --testsuite-name $@ --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
+       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
 test-unhandled-exception-2-255-with-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
-       $(RUNTIME) ./test-runner.exe -j a --testsuite-name $@ --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
+       $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
 test-unhandled-exception-2-255-without-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
-       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) ./test-runner.exe -j a --testsuite-name $@ --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
+       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
 
 endif
 
@@ -1458,7 +1464,7 @@ PROCESS_STRESS_TESTS=     \
                process-leak.exe
 
 test-process-stress: $(PROCESS_STRESS_TESTS) test-runner.exe
-       $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 600 $(PROCESS_STRESS_TESTS)
+       $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 600 $(PROCESS_STRESS_TESTS)
 
 coreclr-gcstress:
        $(MAKE) -C $(mono_build_root)/acceptance-tests coreclr-gcstress
index 650e7716e583d8af4318a59a900c7ad8b742780c..1f2930da9655300e0a32a48da28c4f7ec9d69bd1 100644 (file)
@@ -1228,14 +1228,29 @@ mono_test_marshal_stringbuilder_ref (char **s)
        return 0;
 }
 
+#ifdef __GNUC__
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wc++-compat"
+#endif
+
+/*
+* Standard C and C++ doesn't allow empty structs, empty structs will always have a size of 1 byte.
+* GCC have an extension to allow empty structs, https://gcc.gnu.org/onlinedocs/gcc/Empty-Structures.html.
+* This cause a little dilemma since runtime build using none GCC compiler will not be compatible with
+* GCC build C libraries and the other way around. On platforms where empty structs has size of 1 byte
+* it must be represented in call and cannot be dropped. On Windows x64 structs will always be represented in the call
+* meaning that an empty struct must have a representation in the callee in order to correctly follow the ABI used by the
+* C/C++ standard and the runtime.
+*/
 typedef struct {
-#ifndef __GNUC__
+#if !defined(__GNUC__) || (defined(TARGET_WIN32) && defined(TARGET_AMD64))
     char a;
 #endif
 } EmptyStruct;
+
+#ifdef __GNUC__
 #pragma GCC diagnostic pop
+#endif
 
 LIBTEST_API int STDCALL 
 mono_test_marshal_empty_string_array (char **array)
index dfc88b5c3407e183fc82e4d033cc84dcf38fa8b1..0d2110898cc8c9cc4ea139451f7d3837ad8ec701 100644 (file)
@@ -22,7 +22,7 @@ public class Tests
                Thread.Sleep (1000);
                finished = true;
                sw.Stop ();
-               if (sw.ElapsedMilliseconds > 1500) {
+               if (sw.ElapsedMilliseconds > 2000) {
                        Console.WriteLine (sw.ElapsedMilliseconds);
                        return 1;
                } else {
index baf0609a3bfe3a23963411bd055ca82f2887e6dd..8a0d2a96a05a3a5671d84819c2ec813ecf23e1ea 100644 (file)
@@ -50,6 +50,7 @@ public class TestRunner
 
                string disabled_tests = null;
                string runtime = "mono";
+               string config = null;
                var opt_sets = new List<string> ();
 
                // Process options
@@ -87,6 +88,13 @@ public class TestRunner
                                        }
                                        runtime = args [i + 1];
                                        i += 2;
+                               } else if (args [i] == "--config") {
+                                       if (i + 1 >= args.Length) {
+                                               Console.WriteLine ("Missing argument to --config command line option.");
+                                               return 1;
+                                       }
+                                       config = args [i + 1];
+                                       i += 2;
                                } else if (args [i] == "--opt-sets") {
                                        if (i + 1 >= args.Length) {
                                                Console.WriteLine ("Missing argument to --opt-sets command line option.");
@@ -207,6 +215,8 @@ public class TestRunner
                                        info.RedirectStandardOutput = true;
                                        info.RedirectStandardError = true;
                                        info.EnvironmentVariables[ENV_TIMEOUT] = timeout.ToString();
+                                       if (config != null)
+                                               info.EnvironmentVariables["MONO_CONFIG"] = config;
                                        Process p = new Process ();
                                        p.StartInfo = info;
 
index 2c86105e9a0d2d48c1c8dd866fc915bc2cc295e3..c471b3cf6c0d509db693f7bf12a11cde2bbd5c3f 100644 (file)
@@ -1,5 +1,7 @@
 <configuration>
        <dllmap dll="cygwin1.dll" target="@LIBC@" />
        <dllmap dll="libc" target="@LIBC@" />
+       <dllmap os="windows" cpu="x86" dll="libtest" target="../../msvc/Win32/bin/Release/libtest.dll" />
+       <dllmap os="windows" cpu="x86-64" dll="libtest" target="../../msvc/x64/bin/Release/libtest.dll" />
 </configuration>
 
index 6cf8065d06a43e421bfb59737800ff73536d3f86..d5621323f9f64289ae8e3396cb5f7aaf99f48d23 100644 (file)
@@ -28,6 +28,9 @@
 #include <sys/sysctl.h>
 #include <sys/types.h>
 #else
+#if defined (HAVE_SYS_UTSNAME_H)
+#include <sys/utsname.h>
+#endif
 #include <stdio.h>
 #endif
 
@@ -105,6 +108,50 @@ mono_hwcap_arch_init (void)
         * hit this path if the target doesn't have sys/auxv.h.
         */
 
+#if defined (HAVE_SYS_UTSNAME_H)
+       struct utsname name;
+
+       /* Only fails if `name` is invalid (it isn't). */
+       g_assert (!uname (&name));
+
+       if (!strncmp (name.machine, "aarch64", 7) || !strncmp (name.machine, "armv8", 5)) {
+               /*
+                * We're a 32-bit program running on an ARMv8 system.
+                * Whether the system is actually 32-bit or 64-bit
+                * doesn't matter to us. The important thing is that
+                * all 3 of ARMv8's execution states (A64, A32, T32)
+                * are guaranteed to have all of the features that
+                * we want to detect and use.
+                *
+                * We do this ARMv8 detection via uname () because
+                * in the early days of ARMv8 on Linux, the
+                * /proc/cpuinfo format was a disaster and there
+                * were multiple (merged into mainline) attempts at
+                * cleaning it up (read: breaking applications that
+                * tried to rely on it). So now multiple ARMv8
+                * systems in the wild have different /proc/cpuinfo
+                * output, some of which are downright useless.
+                *
+                * So, when it comes to detecting ARMv8 in a 32-bit
+                * program, it's better to just avoid /proc/cpuinfo
+                * entirely. Maybe in a decade or two, we won't
+                * have to worry about this mess that the Linux ARM
+                * maintainers created. One can hope.
+                */
+
+               mono_hwcap_arm_is_v5 = TRUE;
+               mono_hwcap_arm_is_v6 = TRUE;
+               mono_hwcap_arm_is_v7 = TRUE;
+
+               mono_hwcap_arm_has_vfp = TRUE;
+               mono_hwcap_arm_has_vfp3 = TRUE;
+               mono_hwcap_arm_has_vfp3_d16 = TRUE;
+
+               mono_hwcap_arm_has_thumb = TRUE;
+               mono_hwcap_arm_has_thumb2 = TRUE;
+       }
+#endif
+
        char buf [512];
        char *line;
 
index ace325210599c89703974f27870db8aa7a672b84..63c37b09e86133353414a3f5c0f062a5cb88a1ff 100755 (executable)
@@ -16,6 +16,9 @@ if [[ ${label} != w* ]] && [[ ${label} != 'debian-ppc64el' ]] && [[ ${label} !=
     then
     EXTRA_CONF_FLAGS="$EXTRA_CONF_FLAGS --with-monodroid --with-monotouch --with-monotouch_watch --with-monotouch_tv --with-xammac --with-mobile_static"
     # only enable the mobile profiles and mobile_static on the main architectures
+
+       # only enable the concurrent collector by default on main unix archs
+       EXTRA_CONF_FLAGS="$EXTRA_CONF_FLAGS --with-sgen-default-concurrent=yes"
 fi
 
 if [ -x "/usr/bin/dpkg-architecture" ];
index 3b30bc16f83c4375cb87ec9f0ba6b6bb119870a3..9aebe325e6e7506634247e6e38bd61c17ae371e2 100644 (file)
@@ -1,3 +1,3 @@
-SUBDIRS = locale-builder sgen monograph
+SUBDIRS = locale-builder sgen monograph pedump
 
 
index 123d63d2fb1e4353e385d15752b59816663d5417..3c52afc663451226a7b6b16a459081eec5e1bb7b 100644 (file)
@@ -6,18 +6,14 @@ endif
 if DISABLE_EXECUTABLES
 runtime_lib=$(top_builddir)/mono/mini/$(LIBMONO_LA) $(static_libs)
 else
-if !SHARED_MONO
 static_libs=   \
-       $(top_builddir)/mono/metadata/libmonoruntime-static.la  \
+       $(top_builddir)/mono/metadata/libmonoruntimesgen-static.la      \
        $(top_builddir)/mono/io-layer/libwapi.la        \
        $(top_builddir)/mono/utils/libmonoutils.la \
        $(GLIB_LIBS) $(LIBICONV) \
        $(LIBGC_STATIC_LIBS)
 
 runtime_lib=$(top_builddir)/mono/mini/$(LIBMONO_LA) $(static_libs)
-else
-runtime_lib=$(top_builddir)/mono/mini/$(LIBMONO_LA)
-endif
 endif
 
 if DISABLE_EXECUTABLES
@@ -26,7 +22,7 @@ else
 if DISABLE_LIBRARIES
 bin_PROGRAMS =
 else
-if SUPPORT_BOEHM
+if SUPPORT_SGEN
 bin_PROGRAMS = monograph
 endif
 endif
diff --git a/tools/pedump/.gitignore b/tools/pedump/.gitignore
new file mode 100644 (file)
index 0000000..a73a752
--- /dev/null
@@ -0,0 +1,5 @@
+/Makefile.in
+/Makefile
+/pedump
+/pedump.exe
+
diff --git a/tools/pedump/Makefile.am b/tools/pedump/Makefile.am
new file mode 100644 (file)
index 0000000..d329d1f
--- /dev/null
@@ -0,0 +1,31 @@
+
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) $(SHARED_CFLAGS)
+
+if DISABLE_EXECUTABLES
+bin_PROGRAMS =
+else
+if DISABLE_LIBRARIES
+bin_PROGRAMS =
+else
+if SUPPORT_SGEN
+bin_PROGRAMS = pedump
+endif
+endif
+endif
+
+pedump_SOURCES =               \
+       pedump.c
+
+pedump_LDADD =                         \
+       $(top_builddir)/mono/metadata/libmonoruntimesgen-static.la \
+       $(top_builddir)/mono/sgen/libmonosgen-static.la \
+       $(top_builddir)/mono/io-layer/libwapi.la        \
+       $(top_builddir)/mono/utils/libmonoutils.la \
+       $(LLVM_LIBS)                    \
+       $(LLVM_LDFLAGS)                 \
+       $(GLIB_LIBS)                    \
+       $(LIBICONV)
+
+if PLATFORM_DARWIN
+pedump_LDFLAGS=-framework CoreFoundation -framework Foundation
+endif
diff --git a/tools/pedump/pedump.c b/tools/pedump/pedump.c
new file mode 100644 (file)
index 0000000..4bbcc69
--- /dev/null
@@ -0,0 +1,750 @@
+/*
+ * pedump.c: Dumps the contents of an extended PE/COFF file
+ *
+ * Author:
+ *   Miguel de Icaza (miguel@ximian.com)
+ *
+ * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
+ * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mono/metadata/image.h>
+#include <glib.h>
+#include <mono/metadata/cil-coff.h>
+#include <mono/metadata/mono-endian.h>
+#include <mono/metadata/verify.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/debug-helpers.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/metadata-internals.h>
+#include <mono/metadata/class-internals.h>
+#include <mono/metadata/verify-internals.h>
+#include <mono/metadata/marshal.h>
+#include "mono/utils/mono-digest.h"
+#include <mono/utils/mono-mmap.h>
+#include <mono/utils/mono-counters.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+gboolean dump_data = TRUE;
+gboolean verify_pe = FALSE;
+gboolean verify_metadata = FALSE;
+gboolean verify_code = FALSE;
+gboolean verify_partial_md = FALSE;
+
+static MonoAssembly *pedump_preload (MonoAssemblyName *aname, gchar **assemblies_path, gpointer user_data);
+static void pedump_assembly_load_hook (MonoAssembly *assembly, gpointer user_data);
+static MonoAssembly *pedump_assembly_search_hook (MonoAssemblyName *aname, gpointer user_data);
+
+/* unused
+static void
+hex_dump (const char *buffer, int base, int count)
+{
+       int i;
+       
+       for (i = 0; i < count; i++){
+               if ((i % 16) == 0)
+                       printf ("\n0x%08x: ", (unsigned char) base + i);
+
+               printf ("%02x ", (unsigned char) (buffer [i]));
+       }
+}
+*/
+
+static void
+hex8 (const char *label, unsigned char x)
+{
+       printf ("\t%s: 0x%02x\n", label, (unsigned char) x);
+}
+
+static void
+hex16 (const char *label, guint16 x)
+{
+       printf ("\t%s: 0x%04x\n", label, x);
+}
+
+static void
+hex32 (const char *label, guint32 x)
+{
+       printf ("\t%s: 0x%08x\n", label, x);
+}
+
+static void
+dump_coff_header (MonoCOFFHeader *coff)
+{
+       printf ("\nCOFF Header:\n");
+       hex16 ("                Machine", coff->coff_machine);
+       hex16 ("               Sections", coff->coff_sections);
+       hex32 ("             Time stamp", coff->coff_time);
+       hex32 ("Pointer to Symbol Table", coff->coff_symptr);
+       hex32 ("           Symbol Count", coff->coff_symcount);
+       hex16 ("   Optional Header Size", coff->coff_opt_header_size);
+       hex16 ("        Characteristics", coff->coff_attributes);
+
+}
+
+static void
+dump_pe_header (MonoPEHeader *pe)
+{
+       printf ("\nPE Header:\n");
+       hex16 ("         Magic (0x010b)", pe->pe_magic);
+       hex8  ("             LMajor (6)", pe->pe_major);
+       hex8  ("             LMinor (0)", pe->pe_minor);
+       hex32 ("              Code Size", pe->pe_code_size);
+       hex32 ("  Initialized Data Size", pe->pe_data_size);
+       hex32 ("Uninitialized Data Size", pe->pe_uninit_data_size);
+       hex32 ("        Entry Point RVA", pe->pe_rva_entry_point);
+       hex32 ("          Code Base RVA", pe->pe_rva_code_base);
+       hex32 ("          Data Base RVA", pe->pe_rva_data_base);
+       printf ("\n");
+}
+
+static void
+dump_nt_header (MonoPEHeaderNT *nt)
+{
+       printf ("\nNT Header:\n");
+
+       hex32 ("   Image Base (0x400000)", nt->pe_image_base);
+       hex32 ("Section Alignment (8192)", nt->pe_section_align);
+       hex32 ("   File Align (512/4096)", nt->pe_file_alignment);
+       hex16 ("            OS Major (4)", nt->pe_os_major);
+       hex16 ("            OS Minor (0)", nt->pe_os_minor);
+       hex16 ("          User Major (0)", nt->pe_user_major);
+       hex16 ("          User Minor (0)", nt->pe_user_minor);
+       hex16 ("        Subsys major (4)", nt->pe_subsys_major);
+       hex16 ("        Subsys minor (0)", nt->pe_subsys_minor);
+       hex32 ("               Reserverd", nt->pe_reserved_1);
+       hex32 ("              Image Size", nt->pe_image_size);
+       hex32 ("             Header Size", nt->pe_header_size);
+       hex32 ("            Checksum (0)", nt->pe_checksum);
+       hex16 ("               Subsystem", nt->pe_subsys_required);
+       hex16 ("           DLL Flags (0)", nt->pe_dll_flags);
+       hex32 (" Stack Reserve Size (1M)", nt->pe_stack_reserve);
+       hex32 ("Stack commit Size (4096)", nt->pe_stack_commit);
+       hex32 ("  Heap Reserve Size (1M)", nt->pe_heap_reserve);
+       hex32 (" Heap Commit Size (4096)", nt->pe_heap_commit);
+       hex32 ("      Loader flags (0x1)", nt->pe_loader_flags);
+       hex32 ("   Data Directories (16)", nt->pe_data_dir_count);
+}
+
+static void
+dent (const char *label, MonoPEDirEntry de)
+{
+       printf ("\t%s: 0x%08x [0x%08x]\n", label, de.rva, de.size);
+}
+
+static void
+dump_blob (const char *desc, const char* p, guint32 size)
+{
+       int i;
+
+       printf ("%s", desc);
+       if (!p) {
+               printf (" none\n");
+               return;
+       }
+
+       for (i = 0; i < size; ++i) {
+               if (!(i % 16))
+                       printf ("\n\t");
+               printf (" %02X", p [i] & 0xFF);
+       }
+       printf ("\n");
+}
+
+static void
+dump_public_key (MonoImage *m)
+{
+       guint32 size;
+       const char *p;
+
+       p = mono_image_get_public_key (m, &size);
+       dump_blob ("\nPublic key:", p, size);
+}
+
+static void
+dump_strong_name (MonoImage *m)
+{
+       guint32 size;
+       const char *p;
+
+       p = mono_image_get_strong_name (m, &size);
+       dump_blob ("\nStrong name:", p, size);
+}
+
+static void
+dump_datadir (MonoPEDatadir *dd)
+{
+       printf ("\nData directories:\n");
+       dent ("     Export Table", dd->pe_export_table);
+       dent ("     Import Table", dd->pe_import_table);
+       dent ("   Resource Table", dd->pe_resource_table);
+       dent ("  Exception Table", dd->pe_exception_table);
+       dent ("Certificate Table", dd->pe_certificate_table);
+       dent ("      Reloc Table", dd->pe_reloc_table);
+       dent ("            Debug", dd->pe_debug);
+       dent ("        Copyright", dd->pe_copyright);
+       dent ("       Global Ptr", dd->pe_global_ptr);
+       dent ("        TLS Table", dd->pe_tls_table);
+       dent ("Load Config Table", dd->pe_load_config_table);
+       dent ("     Bound Import", dd->pe_bound_import);
+       dent ("              IAT", dd->pe_iat);
+       dent ("Delay Import Desc", dd->pe_delay_import_desc);
+       dent ("       CLI Header", dd->pe_cli_header);
+}
+
+static void
+dump_dotnet_header (MonoDotNetHeader *header)
+{
+       dump_coff_header (&header->coff);
+       dump_pe_header (&header->pe);
+       dump_nt_header (&header->nt);
+       dump_datadir (&header->datadir);
+}
+
+static void
+dump_section_table (MonoSectionTable *st)
+{
+       guint32 flags = st->st_flags;
+               
+       printf ("\n\tName: %s\n", st->st_name);
+       hex32 ("   Virtual Size", st->st_virtual_size);
+       hex32 ("Virtual Address", st->st_virtual_address);
+       hex32 ("  Raw Data Size", st->st_raw_data_size);
+       hex32 ("   Raw Data Ptr", st->st_raw_data_ptr);
+       hex32 ("      Reloc Ptr", st->st_reloc_ptr);
+       hex32 ("     LineNo Ptr", st->st_lineno_ptr);
+       hex16 ("    Reloc Count", st->st_reloc_count);
+       hex16 ("     Line Count", st->st_line_count);
+
+       printf ("\tFlags: %s%s%s%s%s%s%s%s%s%s\n",
+               (flags & SECT_FLAGS_HAS_CODE) ? "code, " : "",
+               (flags & SECT_FLAGS_HAS_INITIALIZED_DATA) ? "data, " : "",
+               (flags & SECT_FLAGS_HAS_UNINITIALIZED_DATA) ? "bss, " : "",
+               (flags & SECT_FLAGS_MEM_DISCARDABLE) ? "discard, " : "",
+               (flags & SECT_FLAGS_MEM_NOT_CACHED) ? "nocache, " : "",
+               (flags & SECT_FLAGS_MEM_NOT_PAGED) ? "nopage, " : "",
+               (flags & SECT_FLAGS_MEM_SHARED) ? "shared, " : "",
+               (flags & SECT_FLAGS_MEM_EXECUTE) ? "exec, " : "",
+               (flags & SECT_FLAGS_MEM_READ) ? "read, " : "",
+               (flags & SECT_FLAGS_MEM_WRITE) ? "write" : "");
+}
+
+static void
+dump_sections (MonoCLIImageInfo *iinfo)
+{
+       const int top = iinfo->cli_header.coff.coff_sections;
+       int i;
+       
+       for (i = 0; i < top; i++)
+               dump_section_table (&iinfo->cli_section_tables [i]);
+}
+
+static void
+dump_cli_header (MonoCLIHeader *ch)
+{
+       printf ("\n");
+       printf ("          CLI header size: %d\n", ch->ch_size);
+       printf ("         Runtime required: %d.%d\n", ch->ch_runtime_major, ch->ch_runtime_minor);
+       printf ("                    Flags: %s, %s, %s, %s\n",
+               (ch->ch_flags & CLI_FLAGS_ILONLY ? "ilonly" : "contains native"),
+               (ch->ch_flags & CLI_FLAGS_32BITREQUIRED ? "32bits" : "32/64"),
+               (ch->ch_flags & CLI_FLAGS_TRACKDEBUGDATA ? "trackdebug" : "no-trackdebug"),
+               (ch->ch_flags & CLI_FLAGS_STRONGNAMESIGNED ? "strongnamesigned" : "notsigned"));
+       dent   ("         Metadata", ch->ch_metadata);
+       hex32  ("Entry Point Token", ch->ch_entry_point);
+       dent   ("     Resources at", ch->ch_resources);
+       dent   ("   Strong Name at", ch->ch_strong_name);
+       dent   ("  Code Manager at", ch->ch_code_manager_table);
+       dent   ("  VTableFixups at", ch->ch_vtable_fixups);
+       dent   ("     EAT jumps at", ch->ch_export_address_table_jumps);
+}      
+
+static void
+dsh (const char *label, MonoImage *meta, MonoStreamHeader *sh)
+{
+       printf ("%s: 0x%08x - 0x%08x [%d == 0x%08x]\n",
+               label,
+               (int)(sh->data - meta->raw_metadata), (int)(sh->data + sh->size - meta->raw_metadata),
+               sh->size, sh->size);
+}
+
+static void
+dump_metadata_header (MonoImage *meta)
+{
+       printf ("\nMetadata header:\n");
+       printf ("           Version: %d.%d\n", meta->md_version_major, meta->md_version_minor);
+       printf ("    Version string: %s\n", meta->version);
+}
+
+static void
+dump_metadata_ptrs (MonoImage *meta)
+{
+       printf ("\nMetadata pointers:\n");
+       dsh ("\tTables (#~)", meta, &meta->heap_tables);
+       dsh ("\t    Strings", meta, &meta->heap_strings);
+       dsh ("\t       Blob", meta, &meta->heap_blob);
+       dsh ("\tUser string", meta, &meta->heap_us);
+       dsh ("\t       GUID", meta, &meta->heap_guid);
+}
+
+static void
+dump_metadata (MonoImage *meta)
+{
+       int table;
+
+       dump_metadata_header (meta);
+
+       dump_metadata_ptrs (meta);
+
+       printf ("Rows:\n");
+       for (table = 0; table < MONO_TABLE_NUM; table++){
+               if (meta->tables [table].rows == 0)
+                       continue;
+               printf ("Table %s: %d records (%d bytes, at %x)\n",
+                       mono_meta_table_name (table),
+                       meta->tables [table].rows,
+                       meta->tables [table].row_size,
+                       (unsigned int)(meta->tables [table].base - meta->raw_data)
+                       );
+       }
+}
+
+static void
+dump_methoddef (MonoImage *metadata, guint32 token)
+{
+       const char *loc;
+
+       if (!token)
+               return;
+       loc = mono_metadata_locate_token (metadata, token);
+
+       printf ("RVA for Entry Point: 0x%08x\n", read32 (loc));
+}
+
+static void
+dump_dotnet_iinfo (MonoImage *image)
+{
+       MonoCLIImageInfo *iinfo = (MonoCLIImageInfo *)image->image_info;
+
+       dump_dotnet_header (&iinfo->cli_header);
+       dump_sections (iinfo);
+       dump_cli_header (&iinfo->cli_cli_header);
+       dump_strong_name (image);
+       dump_public_key (image);
+       dump_metadata (image);
+
+       dump_methoddef (image, iinfo->cli_cli_header.ch_entry_point);
+}
+
+static int
+dump_verify_info (MonoImage *image, int flags)
+{
+       GSList *errors, *tmp;
+       int count = 0, verifiable = 0;
+       const char* desc [] = {
+               "Ok", "Error", "Warning", NULL, "CLS", NULL, NULL, NULL, "Not Verifiable"
+       };
+
+       if (verify_code) { /* verify code */
+               int i;
+               MonoTableInfo *m = &image->tables [MONO_TABLE_METHOD];
+
+               for (i = 0; i < m->rows; ++i) {
+                       MonoMethod *method;
+                       MonoError error;
+
+                       method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i+1), NULL, NULL, &error);
+                       if (!method) {
+                               g_print ("Warning: Cannot lookup method with token 0x%08x due to %s\n", i + 1, mono_error_get_message (&error));
+                               mono_error_cleanup (&error);
+                               continue;
+                       }
+                       errors = mono_method_verify (method, flags);
+                       if (errors) {
+                               MonoClass *klass = mono_method_get_class (method);
+                               char *name = mono_type_full_name (&klass->byval_arg);
+                               if (mono_method_signature (method) == NULL) {
+                                       g_print ("In method: %s::%s(ERROR)\n", name, mono_method_get_name (method));
+                               } else {
+                                       char *sig;
+                                       sig = mono_signature_get_desc (mono_method_signature (method), FALSE);  
+                                       g_print ("In method: %s::%s(%s)\n", name, mono_method_get_name (method), sig);
+                                       g_free (sig);
+                               }
+                               g_free (name);
+                       }
+
+                       for (tmp = errors; tmp; tmp = tmp->next) {
+                               MonoVerifyInfo *info = (MonoVerifyInfo *)tmp->data;
+                               g_print ("%s: %s\n", desc [info->status], info->message);
+                               if (info->status == MONO_VERIFY_ERROR) {
+                                       count++;
+                                       verifiable = 3;
+                               }
+                               if(info->status == MONO_VERIFY_NOT_VERIFIABLE) {
+                                       if (verifiable < 2)
+                                               verifiable = 2; 
+                               }
+                       }
+                       mono_free_verify_list (errors);
+               }
+       }
+
+       if (count)
+               g_print ("Error count: %d\n", count);
+       return verifiable;
+}
+
+static void
+usage (void)
+{
+       printf ("Usage is: pedump [--verify error,warn,cls,all,code,fail-on-verifiable,non-strict,valid-only,metadata] file.exe\n");
+       exit (1);
+}
+
+static int
+verify_image_file (const char *fname)
+{
+       GSList *errors = NULL, *tmp;
+       MonoImage *image;
+       MonoTableInfo *table;
+       MonoAssembly *assembly;
+       MonoImageOpenStatus status;
+       int i, count = 0;
+       const char* desc [] = {
+               "Ok", "Error", "Warning", NULL, "CLS", NULL, NULL, NULL, "Not Verifiable"
+       };
+
+       image = mono_image_open_raw (fname, &status);
+       if (!image) {
+               printf ("Could not open %s\n", fname);
+               return 1;
+       }
+
+       if (!mono_verifier_verify_pe_data (image, &errors))
+               goto invalid_image;
+
+       if (!mono_image_load_pe_data (image)) {
+               printf ("Could not load pe data for assembly %s\n", fname);
+               return 1;
+       }
+
+       if (!mono_verifier_verify_cli_data (image, &errors))
+               goto invalid_image;
+
+       if (!mono_image_load_cli_data (image)) {
+               printf ("Could not load cli data for assembly %s\n", fname);
+               return 1;
+       }
+
+       if (!mono_verifier_verify_table_data (image, &errors))
+               goto invalid_image;
+
+       mono_image_load_names (image);
+
+       /*fake an assembly for class loading to work*/
+       assembly = g_new0 (MonoAssembly, 1);
+       assembly->in_gac = FALSE;
+       assembly->image = image;
+       image->assembly = assembly;
+       mono_assembly_fill_assembly_name (image, &assembly->aname);
+
+       /*Finish initializing the runtime*/
+       mono_install_assembly_load_hook (pedump_assembly_load_hook, NULL);
+       mono_install_assembly_search_hook (pedump_assembly_search_hook, NULL);
+
+       mono_init_version ("pedump", image->version);
+
+       mono_install_assembly_preload_hook (pedump_preload, GUINT_TO_POINTER (FALSE));
+
+       mono_icall_init ();
+       mono_marshal_init ();
+
+
+       if (!verify_partial_md && !mono_verifier_verify_full_table_data (image, &errors))
+               goto invalid_image;
+
+
+       table = &image->tables [MONO_TABLE_TYPEDEF];
+       for (i = 1; i <= table->rows; ++i) {
+               MonoError error;
+               guint32 token = i | MONO_TOKEN_TYPE_DEF;
+               MonoClass *klass = mono_class_get_checked (image, token, &error);
+               if (!klass) {
+                       printf ("Could not load class with token %x due to %s\n", token, mono_error_get_message (&error));
+                       mono_error_cleanup (&error);
+                       continue;
+               }
+               mono_class_init (klass);
+               if (mono_class_has_failure (klass)) {
+                       printf ("Error verifying class(0x%08x) %s.%s a type load error happened\n", token, klass->name_space, klass->name);
+                       ++count;
+               }
+
+               mono_class_setup_vtable (klass);
+               if (mono_class_has_failure (klass)) {
+                       printf ("Error verifying class(0x%08x) %s.%s a type load error happened\n", token, klass->name_space, klass->name);
+                       ++count;
+               }
+       }
+       if (count)
+               return 5;
+       return 0;
+
+invalid_image:
+       for (tmp = errors; tmp; tmp = tmp->next) {
+               MonoVerifyInfo *info = (MonoVerifyInfo *)tmp->data;
+               g_print ("%s: %s\n", desc [info->status], info->message);
+               if (info->status == MONO_VERIFY_ERROR)
+                       count++;
+       }
+       mono_free_verify_list (errors);
+       if (count)
+               g_print ("Error count: %d\n", count);
+       return 1;
+}
+
+static gboolean
+try_load_from (MonoAssembly **assembly, const gchar *path1, const gchar *path2,
+                                       const gchar *path3, const gchar *path4, gboolean refonly)
+{
+       gchar *fullpath;
+
+       *assembly = NULL;
+       fullpath = g_build_filename (path1, path2, path3, path4, NULL);
+       if (g_file_test (fullpath, G_FILE_TEST_IS_REGULAR))
+               *assembly = mono_assembly_open_full (fullpath, NULL, refonly);
+
+       g_free (fullpath);
+       return (*assembly != NULL);
+}
+
+static MonoAssembly *
+real_load (gchar **search_path, const gchar *culture, const gchar *name, gboolean refonly)
+{
+       MonoAssembly *result = NULL;
+       gchar **path;
+       gchar *filename;
+       const gchar *local_culture;
+       gint len;
+
+       if (!culture || *culture == '\0') {
+               local_culture = "";
+       } else {
+               local_culture = culture;
+       }
+
+       filename =  g_strconcat (name, ".dll", NULL);
+       len = strlen (filename);
+
+       for (path = search_path; *path; path++) {
+               if (**path == '\0')
+                       continue; /* Ignore empty ApplicationBase */
+
+               /* See test cases in bug #58992 and bug #57710 */
+               /* 1st try: [culture]/[name].dll (culture may be empty) */
+               strcpy (filename + len - 4, ".dll");
+               if (try_load_from (&result, *path, local_culture, "", filename, refonly))
+                       break;
+
+               /* 2nd try: [culture]/[name].exe (culture may be empty) */
+               strcpy (filename + len - 4, ".exe");
+               if (try_load_from (&result, *path, local_culture, "", filename, refonly))
+                       break;
+
+               /* 3rd try: [culture]/[name]/[name].dll (culture may be empty) */
+               strcpy (filename + len - 4, ".dll");
+               if (try_load_from (&result, *path, local_culture, name, filename, refonly))
+                       break;
+
+               /* 4th try: [culture]/[name]/[name].exe (culture may be empty) */
+               strcpy (filename + len - 4, ".exe");
+               if (try_load_from (&result, *path, local_culture, name, filename, refonly))
+                       break;
+       }
+
+       g_free (filename);
+       return result;
+}
+
+/*
+ * Try to load referenced assemblies from assemblies_path.
+ */
+static MonoAssembly *
+pedump_preload (MonoAssemblyName *aname,
+                                gchar **assemblies_path,
+                                gpointer user_data)
+{
+       MonoAssembly *result = NULL;
+       gboolean refonly = GPOINTER_TO_UINT (user_data);
+
+       if (assemblies_path && assemblies_path [0] != NULL) {
+               result = real_load (assemblies_path, aname->culture, aname->name, refonly);
+       }
+
+       return result;
+}
+
+static GList *loaded_assemblies = NULL;
+
+static void
+pedump_assembly_load_hook (MonoAssembly *assembly, gpointer user_data)
+{
+       loaded_assemblies = g_list_prepend (loaded_assemblies, assembly);
+}
+
+static MonoAssembly *
+pedump_assembly_search_hook (MonoAssemblyName *aname, gpointer user_data)
+{
+        GList *tmp;
+
+       for (tmp = loaded_assemblies; tmp; tmp = tmp->next) {
+               MonoAssembly *ass = (MonoAssembly *)tmp->data;
+               if (mono_assembly_names_equal (aname, &ass->aname))
+                      return ass;
+       }
+       return NULL;
+}
+
+#define VALID_ONLY_FLAG 0x08000000
+#define VERIFY_CODE_ONLY MONO_VERIFY_ALL + 1 
+#define VERIFY_METADATA_ONLY VERIFY_CODE_ONLY + 1
+#define VERIFY_PARTIAL_METADATA VERIFY_CODE_ONLY + 2
+
+int
+main (int argc, char *argv [])
+{
+       int image_result = 0;
+       MonoImage *image;
+       char *file = NULL;
+       char *flags = NULL;
+       MiniVerifierMode verifier_mode = MONO_VERIFIER_MODE_VERIFIABLE;
+       const char *flag_desc [] = {"error", "warn", "cls", "all", "code", "fail-on-verifiable", "non-strict", "valid-only", "metadata", "partial-md", NULL};
+       guint flag_vals [] = {MONO_VERIFY_ERROR, MONO_VERIFY_WARNING, MONO_VERIFY_CLS, MONO_VERIFY_ALL, VERIFY_CODE_ONLY, MONO_VERIFY_FAIL_FAST, MONO_VERIFY_NON_STRICT, VALID_ONLY_FLAG, VERIFY_METADATA_ONLY, VERIFY_PARTIAL_METADATA, 0};
+       int i, verify_flags = MONO_VERIFY_REPORT_ALL_ERRORS, run_new_metadata_verifier = 0;
+       
+       for (i = 1; i < argc; i++){
+               if (argv [i][0] != '-'){
+                       file = argv [i];
+                       continue;
+               }
+
+               if (strcmp (argv [i], "--help") == 0)
+                       usage ();
+               else if (strcmp (argv [i], "--verify") == 0) {
+                       verify_pe = 1;
+                       dump_data = 0;
+                       ++i;
+                       flags = argv [i];
+               } else {
+                       usage ();
+               }
+       }
+       
+       if (!file)
+               usage ();
+
+#ifndef DISABLE_PERFCOUNTERS
+       mono_perfcounters_init ();
+#endif
+       mono_counters_init ();
+       mono_metadata_init ();
+       mono_images_init ();
+       mono_assemblies_init ();
+       mono_loader_init ();
+       if (verify_pe) {
+               char *tok = strtok (flags, ",");
+
+               verify_metadata = 1;
+               verify_code = 0;
+               while (tok) {
+                       for (i = 0; flag_desc [i]; ++i) {
+                               if (strcmp (tok, flag_desc [i]) == 0) {
+                                       if (flag_vals [i] == VERIFY_CODE_ONLY) {
+                                               verify_metadata = 0;
+                                               verify_code = 1;
+                                       } else if(flag_vals [i] == MONO_VERIFY_ALL) {
+                                               verify_code = 1;
+                                       } else if(flag_vals [i] == VERIFY_METADATA_ONLY) {
+                                               verify_metadata = 0;
+                                               run_new_metadata_verifier = 1;
+                                       } else if(flag_vals [i] == VERIFY_PARTIAL_METADATA) {
+                                               verify_partial_md = 1;
+                                       }
+                                       if (flag_vals [i] == VALID_ONLY_FLAG)
+                                               verifier_mode = MONO_VERIFIER_MODE_VALID;
+                                       else
+                                               verify_flags |= flag_vals [i];
+                                       break;
+                               }
+                       }
+                       if (!flag_desc [i])
+                               g_print ("Unknown verify flag %s\n", tok);
+                       tok = strtok (NULL, ",");
+               }
+
+               mono_verifier_set_mode (verifier_mode);
+               /**/
+       }
+
+       if (verify_pe || run_new_metadata_verifier) {
+               run_new_metadata_verifier = 1;
+       }
+       
+       if (run_new_metadata_verifier) {
+               mono_verifier_set_mode (verifier_mode);
+
+               image_result = verify_image_file (file);
+               if (image_result == 1 || !verify_code)
+                       return image_result;
+       }
+
+       image = mono_image_open (file, NULL);
+       if (!image){
+               fprintf (stderr, "Cannot open image %s\n", file);
+               exit (1);
+       }
+
+       if (dump_data)
+               dump_dotnet_iinfo (image);
+       if (verify_pe) {
+               MonoAssembly *assembly;
+               MonoImage *image;
+               MonoImageOpenStatus status;
+               int code_result;
+
+               mono_verifier_set_mode (verifier_mode);
+
+               assembly = mono_assembly_open (file, NULL);
+               /*fake an assembly for netmodules so the verifier works*/
+               if (!assembly && (image = mono_image_open (file, &status)) && image->tables [MONO_TABLE_ASSEMBLY].rows == 0) {
+                       assembly = g_new0 (MonoAssembly, 1);
+                       assembly->in_gac = FALSE;
+                       assembly->image = image;
+                       image->assembly = assembly;
+               }
+
+               if (!assembly) {
+                       g_print ("Could not open assembly %s\n", file);
+                       return 4;
+               }
+
+               code_result = dump_verify_info (assembly->image, verify_flags);
+               return code_result ? code_result : image_result;
+       } else
+               mono_image_close (image);
+       
+       return 0;
+}
+
index ac155b0cedfb5eb43720b5bc17a86d3250d12f46..c14346f088c28fa88b0b434d4ef80d084634e979 100644 (file)
@@ -3,16 +3,17 @@ bin_PROGRAMS = sgen-grep-binprot
 AM_CPPFLAGS =  $(GLIB_CFLAGS) -I$(top_srcdir)
 
 noinst_LIBRARIES = libsgen-grep-binprot.a libsgen-grep-binprot32p.a libsgen-grep-binprot64p.a
-libsgen_grep_binprot_a_SOURCES = sgen-grep-binprot.c
+libsgen_grep_binprot_a_SOURCES = sgen-grep-binprot.c sgen-grep-binprot.h
 libsgen_grep_binprot_a_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
-libsgen_grep_binprot32p_a_SOURCES = sgen-grep-binprot.c
+libsgen_grep_binprot32p_a_SOURCES = sgen-grep-binprot.c sgen-grep-binprot.h
 libsgen_grep_binprot32p_a_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) -DBINPROT_SIZEOF_VOID_P=4 -DBINPROT_HAS_HEADER
-libsgen_grep_binprot64p_a_SOURCES = sgen-grep-binprot.c
+libsgen_grep_binprot64p_a_SOURCES = sgen-grep-binprot.c sgen-grep-binprot.h
 libsgen_grep_binprot64p_a_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) -DBINPROT_SIZEOF_VOID_P=8 -DBINPROT_HAS_HEADER
 
 sgen_grep_binprot_SOURCES = \
        sgen-grep-binprot-main.c        \
-       sgen-entry-stream.c
+       sgen-entry-stream.c     \
+       sgen-entry-stream.h
 
 sgen_grep_binprot_LDADD = \
        $(GLIB_LIBS) $(LIBICONV) libsgen-grep-binprot.a libsgen-grep-binprot32p.a libsgen-grep-binprot64p.a
index 93251ef2bae707f156cf36eb9b132cca82ec48ff..27eb6276fadbd15d1166548a14c936d4b4928a4d 100755 (executable)
@@ -11,21 +11,25 @@ import subprocess
 
 parser = OptionParser (usage = "Usage: %prog [options] BINARY-PROTOCOL")
 parser.add_option ('--histogram', action = 'store_true', dest = 'histogram', help = "pause time histogram")
+parser.add_option ('--scatter', action = 'store_true', dest = 'scatter', help = "pause time scatterplot")
 parser.add_option ('--minor', action = 'store_true', dest = 'minor', help = "only show minor collections in histogram")
 parser.add_option ('--major', action = 'store_true', dest = 'major', help = "only show major collections in histogram")
 (options, files) = parser.parse_args ()
 
 show_histogram = False
+show_scatter = False
 show_minor = True
 show_major = True
 if options.minor:
-    show_histogram = True
     show_major = False
 if options.major:
-    show_histogram = True
     show_minor = False
 if options.histogram:
     show_histogram = True
+if options.scatter:
+    show_scatter = True
+if (options.minor or options.major) and not options.scatter:
+    show_histogram = True
 
 script_path = os.path.realpath (__file__)
 sgen_grep_path = os.path.join (os.path.dirname (script_path), 'sgen-grep-binprot')
@@ -160,14 +164,33 @@ def parse_major_gcs(data):
         event_group, i = maybe_event_group
         major_gc_events.append(event_group)
 
-if show_histogram:
+if show_histogram or show_scatter:
     bin_data_minor = []
     bin_data_both = []
     bin_data_major = []
     bin_names = []
 
+    timeline_x = []
+    timeline_y = []
+    timeline_c = []
+
     for rec in data:
         pause = rec.stop - rec.start
+
+        color = None
+        if rec.major_work:
+            if rec.minor_work:
+                color = 'purple'
+            else:
+                color = 'red' if show_major else None
+        else:
+            color = 'blue' if show_minor else None
+
+        if color:
+            timeline_x.append(rec.start)
+            timeline_y.append(pause)
+            timeline_c.append(color)
+
         for i in range(100):
             time = (1.3)**(i+6)
             prev_time = 0 if i==0 else (1.3)**(i+5)
@@ -190,18 +213,22 @@ if show_histogram:
     bin_data_both=np.array(bin_data_both)
     bin_data_major=np.array(bin_data_major)
 
-    if show_minor:
-        plt.bar(range(len(bin_data_minor)), bin_data_minor, color='blue', label="minor")  #, align='center')
-        plt.bar(range(len(bin_data_both)), bin_data_both, bottom=bin_data_minor, color='purple', label="minor & major")
-        if show_major:
-            plt.bar(range(len(bin_data_major)), bin_data_major, bottom=(bin_data_minor+bin_data_both), color='red', label="only major")
+    if show_scatter:
+        plt.scatter(timeline_x, timeline_y, c=timeline_c)
     else:
-        plt.bar(range(len(bin_data_major)), bin_data_major, color='red')
-    plt.xticks(range(len(bin_names)), bin_names)
-    plt.ylabel('Cumulative time spent in GC pauses (ms)')
-    plt.xlabel('GC pause length')
-    plt.xticks(rotation=60)
-    plt.legend(loc='upper left')
+        if show_minor:
+            plt.bar(range(len(bin_data_minor)), bin_data_minor, color='blue', label="minor")  #, align='center')
+            plt.bar(range(len(bin_data_both)), bin_data_both, bottom=bin_data_minor, color='purple', label="minor & major")
+            if show_major:
+                plt.bar(range(len(bin_data_major)), bin_data_major, bottom=(bin_data_minor+bin_data_both), color='red', label="only major")
+        else:
+            plt.bar(range(len(bin_data_both)), bin_data_both, color='purple', label="minor & major")
+            plt.bar(range(len(bin_data_major)), bin_data_major, bottom=bin_data_both, color='red')
+        plt.xticks(range(len(bin_names)), bin_names)
+        plt.ylabel('Cumulative time spent in GC pauses (ms)')
+        plt.xlabel('GC pause length')
+        plt.xticks(rotation=60)
+        plt.legend(loc='upper left')
 else:
     major_gc_event_groups = parse_major_gcs(data)