[System] EndRead now throws WebException on abort.
[mono.git] / mono / tests / exception18.cs
1 using System;
2
3 class C
4 {
5         static Exception e;
6
7         static void Throw ()
8         {
9                 try {
10                         int.Parse (null);
11                 } catch (Exception ex) {
12                         e = ex;
13                 }
14         }
15
16         static int FrameCount (Exception ex)
17         {
18                         string fullTrace = ex.StackTrace;
19                         string[] frames = fullTrace.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
20                         return frames.Length;
21         }
22
23         public static void Main ()
24         {
25                 Throw ();
26
27                 try {
28                         throw e;
29                 } catch (Exception ex) {
30                         int frames = FrameCount (ex);
31                         if (frames != 1)
32                                 throw new Exception (String.Format("Exception carried {0} frames along with it when it should have reported one.", frames));
33                 }
34
35                 try {
36                         try {
37                                 int.Parse (null);
38                         } catch (Exception) {
39                                 throw;
40                         }
41                 } catch (Exception ex) {
42                         int frames = FrameCount (ex);
43                         if (frames != 4)
44                                 throw new Exception (String.Format("Exception carried {0} frames along with it when it should have reported four.", frames));
45                 }
46
47         }
48 }