summaryrefslogtreecommitdiff
path: root/proxies/exception_extensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'proxies/exception_extensions.cs')
-rw-r--r--proxies/exception_extensions.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/proxies/exception_extensions.cs b/proxies/exception_extensions.cs
new file mode 100644
index 0000000..e832bfb
--- /dev/null
+++ b/proxies/exception_extensions.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Reflection;
+
+namespace proxies
+{
+ public static class exception_extensions
+ {
+ private static readonly MethodInfo preserveStackTrace =
+ typeof (Exception).GetMethod("InternalPreserveStackTrace",
+ BindingFlags.NonPublic | BindingFlags.Instance);
+
+ public static Exception PreserveStackTrace(this Exception exception)
+ {
+ preserveStackTrace.Invoke(exception, new object[0]);
+ return exception;
+ }
+ }
+} \ No newline at end of file