2004-04-16 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Fri, 16 Apr 2004 09:51:42 +0000 (09:51 -0000)
committerZoltan Varga <vargaz@gmail.com>
Fri, 16 Apr 2004 09:51:42 +0000 (09:51 -0000)
* exceptions.cs: Add regression test for bug #56782.

svn path=/trunk/mono/; revision=25594

mono/mini/ChangeLog
mono/mini/exceptions.cs

index b7ca2326a35fb4d0b56fcde3072712eb6882138b..6557d87fe811079481cc40763b2ba9246cdedb3c 100644 (file)
@@ -1,5 +1,7 @@
 2004-04-16  Zoltan Varga  <vargaz@freemail.hu>
 
+       * exceptions.cs: Add regression test for bug #56782.
+
        * exceptions-*.c (mono_arch_handle_exception): Do not overwrite the
        original stack trace if an exception is rethrown. Fixes #56782. Oh,
        the beauty of fixing the same thing in 5 different files...
index fbfe0378bd0c3066c5d1994fa735d09d804d748e..b92a6449f0120ebaae44befc8e0aa6d2c790f143 100644 (file)
@@ -1857,5 +1857,31 @@ class Tests {
 
                return i;
        }
+
+       static void rethrow1 () {
+               throw new Exception ();
+       }
+
+       static void rethrow2 () {
+               rethrow1 ();
+       }
+
+       static int test_0_rethrow_stacktrace () {
+               // Check that rethrowing an exception preserves the original stack trace
+               try {
+                       try {
+                               rethrow2 ();
+                       }
+                       catch (Exception ex) {
+                               throw;
+                       }
+               }
+               catch (Exception ex) {
+                       if (ex.StackTrace.IndexOf ("rethrow2") != -1)
+                               return 0;
+               }
+
+               return 1;
+       }                       
 }