From 628f566e9a1be0832846914ab62e59b84eff9133 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 19 Mar 2026 15:14:41 +1300 Subject: [PATCH 1/3] Demo capturing screenshots in guides for .net mobile apps Resolves #4117 - #4117 --- docs/platforms/dotnet/guides/android/index.mdx | 6 ++++++ docs/platforms/dotnet/guides/apple/index.mdx | 4 ++++ docs/platforms/dotnet/guides/maui/index.mdx | 3 +++ 3 files changed, 13 insertions(+) diff --git a/docs/platforms/dotnet/guides/android/index.mdx b/docs/platforms/dotnet/guides/android/index.mdx index 6382f4c9bec89f..b4ec4b42767a47 100644 --- a/docs/platforms/dotnet/guides/android/index.mdx +++ b/docs/platforms/dotnet/guides/android/index.mdx @@ -61,6 +61,12 @@ public class MainActivity : Activity // Enable Native Android SDK ANR detection options.Native.AnrEnabled = true; + // If your app doesn't have sensitive data, you can attach screenshots automatically when a Java/native + // error is captured. + // Note: this only applies to Java-based errors; .NET managed exceptions are not currently supported. + // https://docs.sentry.io/platforms/android/enriching-events/screenshots/ + options.Native.AttachScreenshot = true; + // Session Replay is currently available via the ExperimentalOptions options.Native.ExperimentalOptions.SessionReplay.OnErrorSampleRate = 1.0; options.Native.ExperimentalOptions.SessionReplay.SessionSampleRate = 1.0; diff --git a/docs/platforms/dotnet/guides/apple/index.mdx b/docs/platforms/dotnet/guides/apple/index.mdx index fce68d02fa330e..c69bc0d86ebc3b 100644 --- a/docs/platforms/dotnet/guides/apple/index.mdx +++ b/docs/platforms/dotnet/guides/apple/index.mdx @@ -55,6 +55,10 @@ public class AppDelegate : UIApplicationDelegate // Enable Native iOS SDK App Hangs detection options.Native.EnableAppHangTracking = true; + // If your app doesn't have sensitive data, you can get screenshots on error events automatically + // https://docs.sentry.io/platforms/apple/guides/ios/configuration/options/#attach-screenshot + options.Native.AttachScreenshot = true; + options.SetBeforeSend(evt => { if (evt.Exception?.Message.Contains("Something you don't care want logged?") ?? false) diff --git a/docs/platforms/dotnet/guides/maui/index.mdx b/docs/platforms/dotnet/guides/maui/index.mdx index bd422b0b246cb9..4867b6b15f66e4 100644 --- a/docs/platforms/dotnet/guides/maui/index.mdx +++ b/docs/platforms/dotnet/guides/maui/index.mdx @@ -73,6 +73,9 @@ public static MauiApp CreateMauiApp() options.TracesSampleRate = 1.0; // ___PRODUCT_OPTION_END___ performance + // If your app doesn't have sensitive data, you can get screenshots on error events automatically + options.AttachScreenshot = true; + // Other Sentry options can be set here. }) From b0cee03df0ab705638250bb98e59b8f9664fe23e Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 14 Apr 2026 12:03:07 +1200 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: J-P Nurmi --- docs/platforms/dotnet/guides/android/index.mdx | 3 +-- docs/platforms/dotnet/guides/maui/index.mdx | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/platforms/dotnet/guides/android/index.mdx b/docs/platforms/dotnet/guides/android/index.mdx index b4ec4b42767a47..1f4a35b66e58cc 100644 --- a/docs/platforms/dotnet/guides/android/index.mdx +++ b/docs/platforms/dotnet/guides/android/index.mdx @@ -63,8 +63,7 @@ public class MainActivity : Activity // If your app doesn't have sensitive data, you can attach screenshots automatically when a Java/native // error is captured. - // Note: this only applies to Java-based errors; .NET managed exceptions are not currently supported. - // https://docs.sentry.io/platforms/android/enriching-events/screenshots/ + // https://docs.sentry.io/platforms/android/configuration/options/#attachScreenshot options.Native.AttachScreenshot = true; // Session Replay is currently available via the ExperimentalOptions diff --git a/docs/platforms/dotnet/guides/maui/index.mdx b/docs/platforms/dotnet/guides/maui/index.mdx index 4867b6b15f66e4..6cee24b1fe2e78 100644 --- a/docs/platforms/dotnet/guides/maui/index.mdx +++ b/docs/platforms/dotnet/guides/maui/index.mdx @@ -74,6 +74,7 @@ public static MauiApp CreateMauiApp() // ___PRODUCT_OPTION_END___ performance // If your app doesn't have sensitive data, you can get screenshots on error events automatically + // https://docs.sentry.io/platforms/dotnet/guides/maui/configuration/options/#AttachScreenshot options.AttachScreenshot = true; // Other Sentry options can be set here. From 947653d70160eb665fdf6f3b9ef300b73a496037 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 14 Apr 2026 14:18:17 +1200 Subject: [PATCH 3/3] Apply suggestion from @jamescrosswell --- docs/platforms/dotnet/guides/apple/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/dotnet/guides/apple/index.mdx b/docs/platforms/dotnet/guides/apple/index.mdx index c69bc0d86ebc3b..e1b555dc733fac 100644 --- a/docs/platforms/dotnet/guides/apple/index.mdx +++ b/docs/platforms/dotnet/guides/apple/index.mdx @@ -56,7 +56,7 @@ public class AppDelegate : UIApplicationDelegate options.Native.EnableAppHangTracking = true; // If your app doesn't have sensitive data, you can get screenshots on error events automatically - // https://docs.sentry.io/platforms/apple/guides/ios/configuration/options/#attach-screenshot + // https://docs.sentry.io/platforms/apple/guides/ios/configuration/options/#attachScreenshot options.Native.AttachScreenshot = true; options.SetBeforeSend(evt =>