Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

TaskException is sent even if it is marked as Observed #130

Closed
Kn4av opened this issue Feb 6, 2019 · 2 comments
Closed

TaskException is sent even if it is marked as Observed #130

Kn4av opened this issue Feb 6, 2019 · 2 comments
Labels

Comments

@Kn4av
Copy link

Kn4av commented Feb 6, 2019

Our applications rely on third-party libraries. Some of them have unobserved task exceptions. We do handle them by subscribing to TaskScheduler.UnobservedTaskException and marking exceptions as Observed.

TaskScheduler.UnobservedTaskException += OnTaskUnhandledException;

...

private void OnTaskUnhandledException(object sender, UnobservedTaskExceptionEventArgs args)
{
  var aggregateException = args.Exception;
  var baseException = aggregateException.GetBaseException();
  
  if (IsIgnorableException(baseException)
  {
    _logger.Warn(baseException);
    
	args.SetObserved();
    return;
  }
}

However such exceptions are still caught and reported by HockeyApp. Observered task exceptions make big noise in the AppCenter because we cannot distinguish observed and unobserved task exceptions.

We believe that HockeyApp must not report observed task exceptions as unobserved. Please do not report observed task exceptions at all.

Bug is in this line of CrashManager.cs:

TaskScheduler.UnobservedTaskException += (sender, e) => TraceWriter.WriteTrace(e.Exception, terminateOnUnobservedTaskException);

e.Observed is not checked

@ElektrojungeAtWork
Copy link
Contributor

ElektrojungeAtWork commented Feb 19, 2019

Hey @Kn4av,

As you can see, we're almost ready to merge #131. While we discussed this issue and the PR, we noticed that we don't fully understand how you are using UnobservedTaskException. Specifically, we are wondering how you can register a handler for UnobservedTaskException and have the exception not be of that observed type. Are you changing the state of the exception while handling it at some point?
We'd love to learn how you are using them.

Best,
Benjamin

@Kn4av
Copy link
Author

Kn4av commented Feb 22, 2019

Hello @ElektrojungeMS,

As it shown in the code snippet we do args.SetObserved(); to mark exception as observed. Your fix will work for us. Thank you very much!

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants