Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unobserved Task Exception incorrectly causes session to end as crashed #2104

Closed
mattjohnsonpint opened this issue Jan 4, 2023 · 0 comments · Fixed by #2112
Closed

Unobserved Task Exception incorrectly causes session to end as crashed #2104

mattjohnsonpint opened this issue Jan 4, 2023 · 0 comments · Fixed by #2112
Labels
Bug Something isn't working

Comments

@mattjohnsonpint
Copy link
Contributor

When capturing events, we look to see if any unhandled exceptions have occurred and if so we end the session and mark it as crashed.

var hasUnhandledException = evt.HasUnhandledException();
if (hasUnhandledException)
{
// Event contains a terminal exception -> end session as crashed
_options.LogDebug("Ending session as Crashed, due to unhandled exception.");
actualScope.SessionUpdate = _sessionManager.EndSession(SessionEndStatus.Crashed);
}
else if (evt.HasException())
{
// Event contains a non-terminal exception -> report error
// (this might return null if the session has already reported errors before)
actualScope.SessionUpdate = _sessionManager.ReportError();
}

This is a problem if the unhandled exception did not actually cause the application to crash, which happens in the case of an exception in an unobserved task.

ex.Data[Mechanism.HandledKey] = false;
ex.Data[Mechanism.MechanismKey] = "UnobservedTaskException";

We should only end the session if indeed the application is terminating.

Affects Unity also, as per discussion with @bitsandfoxes.

Relates to getsentry/rfcs#10 - but shouldn't depend on it being completed. (We can prevent the end of session whether or not we send that information to Sentry.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant