Skip to content

Commit 73a6c01

Browse files
Apply suggestions from code review
Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
1 parent a7ff327 commit 73a6c01

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Sentry/GlobalSessionManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ private SessionUpdate EndSession(SentrySession session, DateTimeOffset timestamp
253253
if (status == SessionEndStatus.Exited && session.IsMarkedAsPendingUnhandled)
254254
{
255255
status = SessionEndStatus.Unhandled;
256-
_options.LogDebug("Session ended as 'Unhandled' due to pending status.");
256+
_options.LogDebug("Session ended with pending 'Unhandled' (but not `Terminal`) exception.");
257257
}
258258

259259
if (status == SessionEndStatus.Crashed)

src/Sentry/SentrySession.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public class SentrySession : ISentrySession
3636
// Start at -1 so that the first increment puts it at 0
3737
private int _sequenceNumber = -1;
3838

39-
private int _isMarkedAsPendingUnhandled;
39+
private InterlockedBoolean _isMarkedAsPendingUnhandled;
4040

4141
/// <summary>
4242
/// Gets whether this session has an unhandled exception that hasn't been finalized yet.
4343
/// </summary>
44-
internal bool IsMarkedAsPendingUnhandled => _isMarkedAsPendingUnhandled != 0;
44+
internal bool IsMarkedAsPendingUnhandled => _isMarkedAsPendingUnhandled;
4545

4646
internal SentrySession(
4747
SentryId id,
@@ -85,7 +85,7 @@ public SentrySession(string? distinctId, string release, string? environment)
8585
/// Marks the session as having an unhandled exception without ending it.
8686
/// This allows the session to continue and potentially escalate to Crashed if the app crashes.
8787
/// </summary>
88-
internal void MarkUnhandledException() => Interlocked.Exchange(ref _isMarkedAsPendingUnhandled, 1);
88+
internal void MarkUnhandledException() => _isMarkedAsPendingUnhandled.Exchange(true);
8989

9090
internal SessionUpdate CreateUpdate(
9191
bool isInitial,

0 commit comments

Comments
 (0)