diff --git a/Mindscape.Raygun4Net.Tests/RaygunClientTests.cs b/Mindscape.Raygun4Net.Tests/RaygunClientTests.cs index 3e8191fe..e99b191e 100644 --- a/Mindscape.Raygun4Net.Tests/RaygunClientTests.cs +++ b/Mindscape.Raygun4Net.Tests/RaygunClientTests.cs @@ -181,6 +181,17 @@ public void StripMultipleWrapperExceptions() Assert.AreEqual("System.NullReferenceException", message.Details.Error.ClassName); } + [Test] + public void RemoveWrapperExceptions() + { + _client.RemoveWrapperExceptions(typeof(TargetInvocationException)); + + TargetInvocationException wrapper = new TargetInvocationException(_exception); + + RaygunMessage message = _client.ExposeBuildMessage(wrapper); + Assert.AreEqual("System.Reflection.TargetInvocationException", message.Details.Error.ClassName); + } + // Validation tests [Test] diff --git a/Mindscape.Raygun4Net.WinRT/RaygunClient.cs b/Mindscape.Raygun4Net.WinRT/RaygunClient.cs index 63886b12..0354c0b1 100644 --- a/Mindscape.Raygun4Net.WinRT/RaygunClient.cs +++ b/Mindscape.Raygun4Net.WinRT/RaygunClient.cs @@ -82,6 +82,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions) } } } + + /// + /// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception. + /// This can be used to remove the default wrapper exception (TargetInvocationException). + /// + /// Exception types that should no longer be stripped away. + public void RemoveWrapperExceptions(params Type[] wrapperExceptions) + { + foreach (Type wrapper in wrapperExceptions) + { + _wrapperExceptions.Remove(wrapper); + } + } private static RaygunClient _client; diff --git a/Mindscape.Raygun4Net.WindowsPhone/RaygunClient.cs b/Mindscape.Raygun4Net.WindowsPhone/RaygunClient.cs index e42fb842..7c75b698 100644 --- a/Mindscape.Raygun4Net.WindowsPhone/RaygunClient.cs +++ b/Mindscape.Raygun4Net.WindowsPhone/RaygunClient.cs @@ -97,6 +97,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions) } } + /// + /// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception. + /// This can be used to remove the default wrapper exception (TargetInvocationException). + /// + /// Exception types that should no longer be stripped away. + public void RemoveWrapperExceptions(params Type[] wrapperExceptions) + { + foreach (Type wrapper in wrapperExceptions) + { + _wrapperExceptions.Remove(wrapper); + } + } + private static RaygunClient _client; /// diff --git a/Mindscape.Raygun4Net.WindowsStore/RaygunClient.cs b/Mindscape.Raygun4Net.WindowsStore/RaygunClient.cs index 8c462f12..ebb414af 100644 --- a/Mindscape.Raygun4Net.WindowsStore/RaygunClient.cs +++ b/Mindscape.Raygun4Net.WindowsStore/RaygunClient.cs @@ -101,6 +101,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions) } } } + + /// + /// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception. + /// This can be used to remove the default wrapper exception (TargetInvocationException). + /// + /// Exception types that should no longer be stripped away. + public void RemoveWrapperExceptions(params Type[] wrapperExceptions) + { + foreach (Type wrapper in wrapperExceptions) + { + _wrapperExceptions.Remove(wrapper); + } + } private static RaygunClient _client; diff --git a/Mindscape.Raygun4Net.Xamarin.Android/RaygunClient.cs b/Mindscape.Raygun4Net.Xamarin.Android/RaygunClient.cs index 9cfdf8d3..87cf658e 100644 --- a/Mindscape.Raygun4Net.Xamarin.Android/RaygunClient.cs +++ b/Mindscape.Raygun4Net.Xamarin.Android/RaygunClient.cs @@ -85,6 +85,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions) } } + /// + /// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception. + /// This can be used to remove the default wrapper exceptions (TargetInvocationException and AggregateException). + /// + /// Exception types that should no longer be stripped away. + public void RemoveWrapperExceptions(params Type[] wrapperExceptions) + { + foreach (Type wrapper in wrapperExceptions) + { + _wrapperExceptions.Remove(wrapper); + } + } + /// /// Transmits an exception to Raygun.io synchronously, using the version number of the originating assembly. /// diff --git a/Mindscape.Raygun4Net.Xamarin.iOS/RaygunClient.cs b/Mindscape.Raygun4Net.Xamarin.iOS/RaygunClient.cs index f95e54f4..e553ca52 100644 --- a/Mindscape.Raygun4Net.Xamarin.iOS/RaygunClient.cs +++ b/Mindscape.Raygun4Net.Xamarin.iOS/RaygunClient.cs @@ -65,7 +65,7 @@ private bool ValidateApiKey() /// /// Adds a list of outer exceptions that will be stripped, leaving only the valuable inner exception. - /// This can be used when a wrapper exception, e.g. TargetInvocationException or HttpUnhandledException, + /// This can be used when a wrapper exception, e.g. TargetInvocationException or AggregateException, /// contains the actual exception as the InnerException. The message and stack trace of the inner exception will then /// be used by Raygun for grouping and display. The above two do not need to be added manually, /// but if you have other wrapper exceptions that you want stripped you can pass them in here. @@ -82,6 +82,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions) } } + /// + /// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception. + /// This can be used to remove the default wrapper exceptions (TargetInvocationException and AggregateException). + /// + /// Exception types that should no longer be stripped away. + public void RemoveWrapperExceptions(params Type[] wrapperExceptions) + { + foreach (Type wrapper in wrapperExceptions) + { + _wrapperExceptions.Remove(wrapper); + } + } + /// /// Transmits an exception to Raygun.io synchronously, using the version number of the originating assembly. /// diff --git a/Mindscape.Raygun4Net/RaygunClient.cs b/Mindscape.Raygun4Net/RaygunClient.cs index 65fa4331..cd63cdb0 100644 --- a/Mindscape.Raygun4Net/RaygunClient.cs +++ b/Mindscape.Raygun4Net/RaygunClient.cs @@ -132,6 +132,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions) } } + /// + /// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception. + /// This can be used to remove the default wrapper exceptions (TargetInvocationException and HttpUnhandledException). + /// + /// Exception types that should no longer be stripped away. + public void RemoveWrapperExceptions(params Type[] wrapperExceptions) + { + foreach (Type wrapper in wrapperExceptions) + { + _wrapperExceptions.Remove(wrapper); + } + } + /// /// Adds a list of keys to ignore when attaching the Form data of an HTTP POST request. This allows /// you to remove sensitive data from the transmitted copy of the Form on the HttpRequest by specifying the keys you want removed. diff --git a/Mindscape.Raygun4Net2.Tests/RaygunClientTests.cs b/Mindscape.Raygun4Net2.Tests/RaygunClientTests.cs index defa7d61..9d879c70 100644 --- a/Mindscape.Raygun4Net2.Tests/RaygunClientTests.cs +++ b/Mindscape.Raygun4Net2.Tests/RaygunClientTests.cs @@ -183,6 +183,17 @@ public void StripMultipleWrapperExceptions() Assert.AreEqual("System.NullReferenceException", message.Details.Error.ClassName); } + [Test] + public void RemoveWrapperExceptions() + { + _client.RemoveWrapperExceptions(typeof(TargetInvocationException)); + + TargetInvocationException wrapper = new TargetInvocationException(_exception); + + RaygunMessage message = _client.ExposeBuildMessage(wrapper); + Assert.AreEqual("System.Reflection.TargetInvocationException", message.Details.Error.ClassName); + } + // Validation tests [Test] diff --git a/Mindscape.Raygun4Net2/RaygunClient.cs b/Mindscape.Raygun4Net2/RaygunClient.cs index 087cfe0b..7f2a8339 100644 --- a/Mindscape.Raygun4Net2/RaygunClient.cs +++ b/Mindscape.Raygun4Net2/RaygunClient.cs @@ -121,6 +121,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions) } } + /// + /// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception. + /// This can be used to remove the default wrapper exceptions (TargetInvocationException and HttpUnhandledException). + /// + /// Exception types that should no longer be stripped away. + public void RemoveWrapperExceptions(params Type[] wrapperExceptions) + { + foreach (Type wrapper in wrapperExceptions) + { + _wrapperExceptions.Remove(wrapper); + } + } + /// /// Adds a list of keys to ignore when attaching the Form data of an HTTP POST request. This allows /// you to remove sensitive data from the transmitted copy of the Form on the HttpRequest by specifying the keys you want removed. diff --git a/Mindscape.Raygun4Net45/RaygunClientBase.cs b/Mindscape.Raygun4Net45/RaygunClientBase.cs index 036bcc52..3ec6165c 100644 --- a/Mindscape.Raygun4Net45/RaygunClientBase.cs +++ b/Mindscape.Raygun4Net45/RaygunClientBase.cs @@ -129,6 +129,19 @@ public void AddWrapperExceptions(params Type[] wrapperExceptions) } } + /// + /// Specifies types of wrapper exceptions that Raygun should send rather than stripping out and sending the inner exception. + /// This can be used to remove the default wrapper exceptions (TargetInvocationException and HttpUnhandledException). + /// + /// Exception types that should no longer be stripped away. + public void RemoveWrapperExceptions(params Type[] wrapperExceptions) + { + foreach (Type wrapper in wrapperExceptions) + { + _wrapperExceptions.Remove(wrapper); + } + } + /// /// Adds a list of keys to ignore when attaching the Form data of an HTTP POST request. This allows /// you to remove sensitive data from the transmitted copy of the Form on the HttpRequest by specifying the keys you want removed.