[exception] add another testcase where an exception is rethrown explicitly (and there...
authorBernhard Urban <bernhard.urban@xamarin.com>
Mon, 16 Jan 2017 13:46:00 +0000 (14:46 +0100)
committerBernhard Urban <bernhard.urban@xamarin.com>
Wed, 18 Jan 2017 14:47:11 +0000 (15:47 +0100)
mono/tests/exception18.cs

index bfd78df966d71227e842c6ca53efb60d0dcda678..6c9b349ce30e76d986faee4fd36e0e982fb56e70 100644 (file)
@@ -51,22 +51,36 @@ class C
                }
 
                try {
-                       new C ().M1 ();
+                       new C ().M1a ();
                } catch (Exception ex) {
                        int frames = FrameCount (ex);
                        if (frames != 4)
                                throw new Exception (String.Format("Exception carried {0} frames along with it when it should have reported four.", frames));
                }
+
+               try {
+                       new C ().M1b ();
+               } catch (Exception ex) {
+                       int frames = FrameCount (ex);
+                       if (frames != 3)
+                               throw new Exception (String.Format("Exception carried {0} frames along with it when it should have reported three.", frames));
+               }
+       }
+
+       [MethodImpl(MethodImplOptions.NoInlining)]
+       private void M1a ()
+       {
+               M2a ();
        }
 
        [MethodImpl(MethodImplOptions.NoInlining)]
-       private void M1 ()
+       private void M1b ()
        {
-               M2 ();
+               M2b ();
        }
 
        [MethodImpl(MethodImplOptions.NoInlining)]
-       private void M2 ()
+       private void M2a ()
        {
                try {
                        M3 ();
@@ -75,6 +89,16 @@ class C
                }
        }
 
+       [MethodImpl(MethodImplOptions.NoInlining)]
+       private void M2b ()
+       {
+               try {
+                       M3 ();
+               } catch (Exception ex) {
+                       throw ex;
+               }
+       }
+
        [MethodImpl(MethodImplOptions.NoInlining)]
        private void M3 ()
        {