* exceptions.cs: Add regression test for bug #56782.
svn path=/trunk/mono/; revision=25594
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...
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;
+ }
}