X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Ftests%2Fexception18.cs;h=6c9b349ce30e76d986faee4fd36e0e982fb56e70;hb=1af7e953e88b21e3c81f8e761c915cefd017ec7a;hp=8f1e492c0e97bf83d09db8c33f9a95c5ae83bf8e;hpb=cc40e2e17dc6fd2dae6d3a4c7d7ab43570d63546;p=mono.git diff --git a/mono/tests/exception18.cs b/mono/tests/exception18.cs index 8f1e492c0e9..6c9b349ce30 100644 --- a/mono/tests/exception18.cs +++ b/mono/tests/exception18.cs @@ -1,4 +1,6 @@ using System; +using System.Linq; +using System.Runtime.CompilerServices; class C { @@ -17,6 +19,10 @@ class C { string fullTrace = ex.StackTrace; string[] frames = fullTrace.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); + + // Ignore metadata + frames = frames.Where (l => !l.StartsWith ("[")).ToArray (); + return frames.Length; } @@ -44,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 (); } }