Merge pull request #5428 from kumpera/wasm-support-p2
[mono.git] / mono / tests / exception18.cs
index 7f3de465449669d4485a34230f94ff97877a6a43..6c9b349ce30e76d986faee4fd36e0e982fb56e70 100644 (file)
@@ -1,5 +1,6 @@
 using System;
 using System.Linq;
+using System.Runtime.CompilerServices;
 
 class C
 {
@@ -49,5 +50,58 @@ class C
                                throw new Exception (String.Format("Exception carried {0} frames along with it when it should have reported four.", frames));
                }
 
+               try {
+                       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 M1b ()
+       {
+               M2b ();
+       }
+
+       [MethodImpl(MethodImplOptions.NoInlining)]
+       private void M2a ()
+       {
+               try {
+                       M3 ();
+               } catch {
+                       throw;
+               }
+       }
+
+       [MethodImpl(MethodImplOptions.NoInlining)]
+       private void M2b ()
+       {
+               try {
+                       M3 ();
+               } catch (Exception ex) {
+                       throw ex;
+               }
+       }
+
+       [MethodImpl(MethodImplOptions.NoInlining)]
+       private void M3 ()
+       {
+               throw new NotImplementedException ();
        }
 }