Skip to content

Commit

Permalink
Fixes #224
Browse files Browse the repository at this point in the history
  • Loading branch information
PhyxionNL authored and niemyjski committed Feb 18, 2020
1 parent 94a0dd5 commit eb45506
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
1 change: 0 additions & 1 deletion src/Platforms/Exceptionless.Wpf/Exceptionless.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<Description>Exceptionless client for WPF applications. $(Description)</Description>
<PackageTags>WPF;Exceptionless;Error;Report;Reporting;Exception;Logging;Log;ELMAH</PackageTags>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>Exceptionless</RootNamespace>
<OutputType>Library</OutputType>
</PropertyGroup>
Expand Down
35 changes: 0 additions & 35 deletions src/Platforms/Exceptionless.Wpf/ExceptionlessClientExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,46 +1,11 @@
using System;
using System.Threading;
using System.Windows.Threading;
using Exceptionless.Dependency;
using Exceptionless.Plugins;
using Exceptionless.Logging;

namespace Exceptionless.Wpf.Extensions {
public static class ExceptionlessClientExtensions {
private static ThreadExceptionEventHandler _onApplicationThreadException;

public static void RegisterApplicationThreadExceptionHandler(this ExceptionlessClient client) {
if (client == null)
throw new ArgumentNullException(nameof(client));

if (_onApplicationThreadException == null)
_onApplicationThreadException = (sender, args) => {
var contextData = new ContextData();
contextData.MarkAsUnhandledError();
contextData.SetSubmissionMethod("ApplicationThreadException");

args.Exception.ToExceptionless(contextData, client).Submit();
};

try {
System.Windows.Forms.Application.ThreadException -= _onApplicationThreadException;
System.Windows.Forms.Application.ThreadException += _onApplicationThreadException;
} catch (Exception ex) {
client.Configuration.Resolver.GetLog().Error(typeof(ExceptionlessClientExtensions), ex, "An error occurred while wiring up to the application thread exception event.");
}
}

public static void UnregisterApplicationThreadExceptionHandler(this ExceptionlessClient client) {
if (client == null)
throw new ArgumentNullException(nameof(client));

if (_onApplicationThreadException == null)
return;

System.Windows.Forms.Application.ThreadException -= _onApplicationThreadException;
_onApplicationThreadException = null;
}

private static DispatcherUnhandledExceptionEventHandler _onApplicationDispatcherUnhandledException;

public static void RegisterApplicationDispatcherUnhandledExceptionHandler(this ExceptionlessClient client) {
Expand Down

0 comments on commit eb45506

Please sign in to comment.