[runtime] Overwrite stacktrace for exception on re-throw. Fixes #1856.
[mono.git] / mono / tests / cas / linkdemand / icall6.cs
1 using System;
2 using System.Reflection;
3 using System.Security;
4 using System.Security.Permissions;
5
6 [assembly: SecurityPermission (SecurityAction.RequestRefuse, UnmanagedCode=true)]
7
8 public class Program {
9
10         // Math.Sin is a "public" internal call for both Mono and Microsoft
11         private const string icall = "Sin";
12
13         static int TestReflectedICall ()
14         {
15                 MethodInfo mi = typeof (System.Math).GetMethod (icall);
16                 if (mi == null) {
17                         Console.WriteLine ("*3* Couldn't reflect on internalcall {0}", icall);
18                         return 3;
19                 }
20
21                 return (int) (double) mi.Invoke (null, new object [1] { 0.0 });
22         }
23
24         static int Main ()
25         {
26                 try {
27                         int result = TestReflectedICall ();
28                         Console.WriteLine ("*{0}* [Reflected]System.Math.Sin(0) == {0}", result);
29                         return result;
30                 }
31                 catch (SecurityException se) {
32                         Console.WriteLine ("*1* SecurityException\n{0}", se);
33                         return 1;
34                 }
35                 catch (Exception e) {
36                         Console.WriteLine ("*2* Unexpected exception\n{0}", e);
37                         return 2;
38                 }
39         }
40 }