Skip to content

iOS app crash when use AttachScreenshot=true #3880

@albilaga

Description

@albilaga

Package

Sentry.Maui

.NET Flavor

Other

.NET Version

8.0.403

OS

iOS

SDK Version

4.13.-

Self-Hosted Sentry Version

No response

Steps to Reproduce

We have error report in Sentry that saying Application Specific Information: UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={810, 1080}, scale=2.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert. when we look at the thread that cause it also contain stack trace saying Sentry_Maui_Sentry_Maui_Internal_ScreenshotAttachmentContent__c__GetStreamb__2_1. I am not really sure actually if this is caused by Sentry or not but we do attach the attachment on sentry so it might be the cause. Here I also attach the crash report dbc983a62a9a4fb7bdef3f940462a18d-symbolicated.crash.zip

Expected Result

App should not crash or throwing exception

Actual Result

App throwing exception

Solution

The root cause is a problem with the MAUI ScreenshotImplementation class. Ideally this would be addressed in the MAUI repo then:

For the time being, we've wrapped our usage of this API in a try..catch/log block. In these instances, no screenshot will be captured but at least the application won't crash.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions