Screenshots

Learn more about taking screenshots when an error occurs. Sentry pairs the screenshot with the original event, giving you additional insight into issues.

Sentry makes it possible to automatically take a screenshot and include it as an attachment when a user experiences an error, an exception, or a crash.

This feature is currently only available on Windows and has a few limitations. For example, the inproc and breakpad backends use local exception handlers for capturing the screenshot and therefore rely on the exception handler being called. Only the crashpad and native backends can capture screenshots of fast-fail crashes that bypass Structured Exception Handling (SEH) because screenshot capture happens out-of-process. However, crashpad does not support the before_screenshot hook, because the screenshot is captured out-of-process and the SDK cannot communicate the hook result to the crashpad_handler. The native backend calls before_screenshot during crash handling and communicates the result to the sentry-crash daemon, which captures the screenshot out-of-process. 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.

Because screenshots may contain PII, they are an opt-in feature. You can enable screenshots as shown below:

Copied
sentry_options_set_attach_screenshot(options, 1);

If one is available, you'll see a thumbnail of the screenshot when you click on a specific issue from the Issues page.

Once you've clicked on the event ID of a specific issue, you'll be able to see an overview of all the attachments as well as associated events in the "Attachments" tab.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").