main
 1using System;
 2using System.Reflection;
 3
 4namespace Gorilla.Commons.Infrastructure.Proxies
 5{
 6    static public class ExceptionExtensions
 7    {
 8        static readonly MethodInfo method =
 9            typeof (Exception).GetMethod("InternalPreserveStackTrace",
10                                         BindingFlags.NonPublic | BindingFlags.Instance);
11
12        static public Exception preserve_stack_trace(this Exception exception)
13        {
14            method.Invoke(exception, new object[0]);
15            return exception;
16        }
17    }
18}