From d72ae5d1650f1c50334252ab9d8ef8c3afee128f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 10 Sep 2025 10:12:25 +0200 Subject: [PATCH 1/3] fix: duplicate Java.Lang.RuntimeException on Android --- src/Sentry/Platforms/Android/SentrySdk.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Sentry/Platforms/Android/SentrySdk.cs b/src/Sentry/Platforms/Android/SentrySdk.cs index b9c6997c8d..2e5cd85918 100644 --- a/src/Sentry/Platforms/Android/SentrySdk.cs +++ b/src/Sentry/Platforms/Android/SentrySdk.cs @@ -168,6 +168,9 @@ private static void InitSentryAndroidSdk(SentryOptions options) SentryAndroid.Init(AppContext, configuration); } + // Don't capture Java Runtime exceptions in the managed SDK, since we already capture them in the native SDK + options.AddExceptionFilterForType(); + // Set options for the managed SDK that depend on the Android SDK. (The user will not be able to modify these.) options.AddEventProcessor(new AndroidEventProcessor(nativeOptions!)); if (options.Android.LogCatIntegration != LogCatIntegrationType.None) From 0ec785e7fd90c1c1ef10db0952d825245ba2b9ba Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 10 Sep 2025 10:17:04 +0200 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ab5882212..bb0367a8ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - `InvalidOperationException` potentially thrown during a race condition, especially in concurrent high-volume logging scenarios ([#4428](https://github.com/getsentry/sentry-dotnet/pull/4428)) - Blocking calls are no longer treated as unhandled crashes ([#4458](https://github.com/getsentry/sentry-dotnet/pull/4458)) - Only apply Session Replay masks to specific control types when necessary to avoid performance issues in MAUI apps with complex UIs ([#4445](https://github.com/getsentry/sentry-dotnet/pull/4445)) +- De-duplicate Java.Lang.RuntimeException on Android ([#4509](https://github.com/getsentry/sentry-dotnet/pull/4509)) ### Dependencies From c8e1eda5efecf7cebc617e2d30989a32eda4ce36 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 10 Sep 2025 10:51:50 +0200 Subject: [PATCH 3/3] Move below "options that depend on the Android SDK" --- src/Sentry/Platforms/Android/SentrySdk.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Sentry/Platforms/Android/SentrySdk.cs b/src/Sentry/Platforms/Android/SentrySdk.cs index 2e5cd85918..5eb4f445f4 100644 --- a/src/Sentry/Platforms/Android/SentrySdk.cs +++ b/src/Sentry/Platforms/Android/SentrySdk.cs @@ -168,9 +168,6 @@ private static void InitSentryAndroidSdk(SentryOptions options) SentryAndroid.Init(AppContext, configuration); } - // Don't capture Java Runtime exceptions in the managed SDK, since we already capture them in the native SDK - options.AddExceptionFilterForType(); - // Set options for the managed SDK that depend on the Android SDK. (The user will not be able to modify these.) options.AddEventProcessor(new AndroidEventProcessor(nativeOptions!)); if (options.Android.LogCatIntegration != LogCatIntegrationType.None) @@ -180,6 +177,8 @@ private static void InitSentryAndroidSdk(SentryOptions options) options.CrashedLastRun = () => JavaSdk.Sentry.IsCrashedLastRun()?.BooleanValue() is true; options.EnableScopeSync = true; options.ScopeObserver = new AndroidScopeObserver(options); + // Don't capture Java Runtime exceptions in the managed SDK, since we already capture them in the native SDK + options.AddExceptionFilterForType(); // TODO: Pause/Resume }