3 using System.Runtime.CompilerServices;
13 } catch (Exception ex) {
18 static int FrameCount (Exception ex)
20 string fullTrace = ex.StackTrace;
21 string[] frames = fullTrace.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
24 frames = frames.Where (l => !l.StartsWith ("[")).ToArray ();
29 public static void Main ()
35 } catch (Exception ex) {
36 int frames = FrameCount (ex);
38 throw new Exception (String.Format("Exception carried {0} frames along with it when it should have reported one.", frames));
47 } catch (Exception ex) {
48 int frames = FrameCount (ex);
50 throw new Exception (String.Format("Exception carried {0} frames along with it when it should have reported four.", frames));
55 } catch (Exception ex) {
56 int frames = FrameCount (ex);
58 throw new Exception (String.Format("Exception carried {0} frames along with it when it should have reported four.", frames));
63 } catch (Exception ex) {
64 int frames = FrameCount (ex);
66 throw new Exception (String.Format("Exception carried {0} frames along with it when it should have reported three.", frames));
70 [MethodImpl(MethodImplOptions.NoInlining)]
76 [MethodImpl(MethodImplOptions.NoInlining)]
82 [MethodImpl(MethodImplOptions.NoInlining)]
92 [MethodImpl(MethodImplOptions.NoInlining)]
97 } catch (Exception ex) {
102 [MethodImpl(MethodImplOptions.NoInlining)]
105 throw new NotImplementedException ();