Skip to content

Commit

Permalink
Fix FirstChanceException handling
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrster committed Apr 17, 2017
1 parent 759ac4e commit 2cb212c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions ContactPoint/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,13 @@ static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEv

static void CurrentDomain_FirstChanceException(object sender, FirstChanceExceptionEventArgs e)
{
#if !DEBUG
CatchUnhandledException(sender, e.Exception, "First chance exception from '{0}'");
#endif
if (e.Exception != null)
{
CatchUnhandledException(sender, e.Exception, "First chance exception from '{0}'", false);
}
}

static void CatchUnhandledException(object sender, Exception e, string message)
static void CatchUnhandledException(object sender, Exception e, string message, bool showExceptionReporter = true)
{
try
{
Expand All @@ -403,18 +404,18 @@ static void CatchUnhandledException(object sender, Exception e, string message)

Logger.LogError(e);

if (!showExceptionReporter || _disableExceptionReporter || ExceptionReporter == null || !Application.MessageLoop)
{
return;
}

#if DEBUG
if (Debugger.IsAttached)
{
Debugger.Break();
}
#endif

if (_disableExceptionReporter || ExceptionReporter == null || !Application.MessageLoop)
{
return;
}

try
{
TakeScreenshot(ExceptionReporter);
Expand Down

0 comments on commit 2cb212c

Please sign in to comment.