From 7024f37efa663bbf054913b5a4659b9b407ab47d Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Mon, 6 Jan 2025 02:51:39 -0500 Subject: [PATCH] Disable and obsolete iOS Watchdog termination (#3867) * Disable and obsolete iOS Watchdog termination * changelog --- CHANGELOG.md | 5 +++++ src/Sentry/Platforms/Cocoa/BindableSentryOptions.cs | 2 ++ src/Sentry/Platforms/Cocoa/SentryOptions.cs | 11 +++++++---- src/Sentry/Platforms/Cocoa/SentrySdk.cs | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 605bb89d1f..627316d4d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +### Fixes + +- .NET Mobile: Disable and made obsolete the iOS Watchdog termination feature which is based on heuristics that don't work in .NET ([#3867](https://github.com/getsentry/sentry-dotnet/pull/3867)) + + ### Dependencies - Bump Native SDK from v0.7.16 to v0.7.17 ([#3857](https://github.com/getsentry/sentry-dotnet/pull/3857)) diff --git a/src/Sentry/Platforms/Cocoa/BindableSentryOptions.cs b/src/Sentry/Platforms/Cocoa/BindableSentryOptions.cs index 5697ccf8cb..af7b318302 100644 --- a/src/Sentry/Platforms/Cocoa/BindableSentryOptions.cs +++ b/src/Sentry/Platforms/Cocoa/BindableSentryOptions.cs @@ -38,7 +38,9 @@ public void ApplyTo(SentryOptions.NativeOptions options) options.EnableFileIOTracing = EnableFileIOTracing ?? options.EnableFileIOTracing; options.EnableNetworkBreadcrumbs = EnableNetworkBreadcrumbs ?? options.EnableNetworkBreadcrumbs; options.EnableNetworkTracking = EnableNetworkTracking ?? options.EnableNetworkTracking; +#pragma warning disable CS0618 // Type or member is obsolete options.EnableWatchdogTerminationTracking = EnableWatchdogTerminationTracking ?? options.EnableWatchdogTerminationTracking; +#pragma warning restore CS0618 // Type or member is obsolete options.EnableSwizzling = EnableSwizzling ?? options.EnableSwizzling; options.EnableUIViewControllerTracing = EnableUIViewControllerTracing ?? options.EnableUIViewControllerTracing; options.EnableUserInteractionTracing = EnableUserInteractionTracing ?? options.EnableUserInteractionTracing; diff --git a/src/Sentry/Platforms/Cocoa/SentryOptions.cs b/src/Sentry/Platforms/Cocoa/SentryOptions.cs index ae28a38afb..f72f37e08b 100644 --- a/src/Sentry/Platforms/Cocoa/SentryOptions.cs +++ b/src/Sentry/Platforms/Cocoa/SentryOptions.cs @@ -128,13 +128,16 @@ internal NativeOptions(SentryOptions options) public bool EnableNetworkTracking { get; set; } = true; /// - /// Whether to enable watchdog termination tracking or not. - /// The default value is true (enabled). + /// Whether to enable watchdog termination tracking or not. NOT advised. + /// The default value is false (disabled). /// /// - /// https://docs.sentry.io/platforms/apple/configuration/watchdog-terminations/ + /// This feature is prone to false positives on .NET since it relies on heuristics that don't work in this environment. /// - public bool EnableWatchdogTerminationTracking { get; set; } = true; + /// + /// + [Obsolete("See: https://github.com/getsentry/sentry-dotnet/issues/3860")] + public bool EnableWatchdogTerminationTracking { get; set; } = false; /// /// Whether the SDK should use swizzling or not. diff --git a/src/Sentry/Platforms/Cocoa/SentrySdk.cs b/src/Sentry/Platforms/Cocoa/SentrySdk.cs index 812733c7c9..c10e22938c 100644 --- a/src/Sentry/Platforms/Cocoa/SentrySdk.cs +++ b/src/Sentry/Platforms/Cocoa/SentrySdk.cs @@ -127,7 +127,9 @@ private static void InitSentryCocoaSdk(SentryOptions options) nativeOptions.EnableFileIOTracing = options.Native.EnableFileIOTracing; nativeOptions.EnableNetworkBreadcrumbs = options.Native.EnableNetworkBreadcrumbs; nativeOptions.EnableNetworkTracking = options.Native.EnableNetworkTracking; +#pragma warning disable CS0618 // Type or member is obsolete nativeOptions.EnableWatchdogTerminationTracking = options.Native.EnableWatchdogTerminationTracking; +#pragma warning restore CS0618 // Type or member is obsolete nativeOptions.EnableSwizzling = options.Native.EnableSwizzling; nativeOptions.EnableUIViewControllerTracing = options.Native.EnableUIViewControllerTracing; nativeOptions.EnableUserInteractionTracing = options.Native.EnableUserInteractionTracing;