-
-
Notifications
You must be signed in to change notification settings - Fork 229
Description
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.
sentry-dotnet/src/Sentry/Internal/Hub.cs
Lines 321 to 333 in af8c42c
| 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.
sentry-dotnet/src/Sentry/Integrations/UnobservedTaskExceptionIntegration.cs
Lines 35 to 36 in af8c42c
| 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.)
Metadata
Metadata
Assignees
Labels
Projects
Status