Skip to content

Commit fd4673d

Browse files
authored
feat(.NET): Screenshots for MAUI (#9120)
1 parent 4a60351 commit fd4673d

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

docs/platforms/dotnet/common/configuration/options.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ This parameter controls whether integrations should capture HTTP request bodies.
175175

176176
</ConfigKey>
177177

178-
<ConfigKey name="attach-screenshot" supported={["dotnet.xamarin"]}>
178+
<ConfigKey name="attach-screenshot" supported={["dotnet.xamarin", "dotnet.maui"]}>
179179

180180
Takes a screenshot of the application when an error happens and includes it as an attachment.
181181
Learn more about enriching events with screenshots in our <PlatformLink to="/enriching-events/screenshots/">Screenshots documentation</PlatformLink>.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: "Screenshots"
3+
description: "Learn more about taking screenshots when an error occurs. Sentry pairs the screenshot with the original event, giving you additional insight into issues."
4+
---
5+
6+
If a user experiences an error, an exception or a crash, Sentry gives you the option to capture a screenshot and include it as an <PlatformLink to="/enriching-events/attachments/">attachment</PlatformLink>.
7+
8+
This feature is only available for SDKs with a user interface, such as the ones for mobile and desktop applications. In some environments like native iOS, taking a screenshot requires the UI thread and in the event of a crash, that might not be available. Another example where a screenshot might not be available is when the event happens before the screen starts to load. So inherently, this feature is a best effort solution.
9+
10+
## Enabling Screenshots
11+
12+
Because screenshots may contain <PlatformLink to="/data-management/sensitive-data/">PII</PlatformLink>, they are an opt-in feature. You can enable screenshots as shown below:
13+
14+
<PlatformContent includePath="enriching-events/attach-screenshots" />
15+
16+
Capturing a screenshot is a synchronous operation supported on both iOS and Android. For iOS, a UI thread is required.
17+
18+
## Viewing Screenshots
19+
20+
If one is available, you'll see a thumbnail of the screenshot if you click on a specific issue from the [**Issues**](https://demo.sentry.io/issues/) page:
21+
22+
![Screenshot Thumbnail](/platforms/dotnet/guides/xamarin/enriching-events/screenshots/screenshot-thumbnail.png)
23+
24+
Once you've clicked on the event ID of specific issue, you'll also be able to view screenshots from the "Attachments" tab where you'll be able to see attachments, as well as associated events.
25+
26+
![Screenshots List Example](/platforms/dotnet/guides/xamarin/enriching-events/screenshots/screenshot-list-example.png)
27+
28+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<SignInNote />
2+
3+
```csharp
4+
var builder = MauiApp.CreateBuilder()
5+
.UseMauiApp<App>()
6+
.UseSentry(options =>
7+
{
8+
options.Dsn = "___PUBLIC_DSN___";
9+
options.AttachScreenshot = true;
10+
})
11+
```

0 commit comments

Comments
 (0)