Skip to content

Commit cc613c9

Browse files
Disable session tracking in SDK initialization (#4341)
* Disable auto session tracking in Android and Cocoa platform SDKs Co-authored-by: bruno <bruno@sentry.io> * Fix double session reporting on mobile platforms Co-authored-by: bruno <bruno@sentry.io> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 748fcfe commit cc613c9

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
### Fixes
1414

15+
- Avoid double reporting sessions on iOS and Android apps ([#4341](https://github.com/getsentry/sentry-dotnet/pull/4341))
1516
- Sentry now decompresses Request bodies in ASP.NET Core when RequestDecompression middleware is enabled ([#4315](https://github.com/getsentry/sentry-dotnet/pull/4315))
1617
- Custom ISentryEventProcessors are now run for native iOS events ([#4318](https://github.com/getsentry/sentry-dotnet/pull/4318))
1718
- Crontab validation when capturing checkins ([#4314](https://github.com/getsentry/sentry-dotnet/pull/4314))

src/Sentry/Platforms/Android/SentrySdk.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ private static void InitSentryAndroidSdk(SentryOptions options)
4747
o.DiagnosticLevel = options.DiagnosticLevel.ToJavaSentryLevel();
4848
o.Dist = options.Distribution;
4949
o.Dsn = options.Dsn;
50-
o.EnableAutoSessionTracking = options.AutoSessionTracking;
50+
// Hardcode to false because .NET SDK manages sessions itself
51+
o.EnableAutoSessionTracking = false;
5152
o.Environment = options.Environment;
5253
o.FlushTimeoutMillis = (long)options.InitCacheFlushTimeout.TotalMilliseconds;
5354
o.MaxAttachmentSize = options.MaxAttachmentSize;

src/Sentry/Platforms/Cocoa/SentrySdk.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ private static void InitSentryCocoaSdk(SentryOptions options)
2424
nativeOptions.Debug = options.Debug;
2525
nativeOptions.DiagnosticLevel = options.DiagnosticLevel.ToCocoaSentryLevel();
2626
nativeOptions.Dsn = options.Dsn;
27-
nativeOptions.EnableAutoSessionTracking = options.AutoSessionTracking;
27+
// Hardcode to false because .NET SDK manages sessions itself
28+
nativeOptions.EnableAutoSessionTracking = false;
2829
nativeOptions.EnableCaptureFailedRequests = options.CaptureFailedRequests;
2930
nativeOptions.FailedRequestStatusCodes = GetFailedRequestStatusCodes(options.FailedRequestStatusCodes);
3031
nativeOptions.MaxAttachmentSize = (nuint)options.MaxAttachmentSize;

0 commit comments

Comments
 (0)