#Using BeforeSend to filter out Screenshots for certain Views in MAUI and Xamarin Forms SDKs
13 messages · Page 1 of 1 (latest)
there is a SetBeforeScreenshotCapture option for MAUI that has not been release yet:
https://github.com/getsentry/sentry-dotnet/issues/3353
https://github.com/getsentry/sentry-dotnet/pull/3661
Problem Statement Something like BeforeCaptureCallback in the Android version (https://docs.sentry.io/platforms/android/enriching-events/screenshots/). There are two reasons why I'm interested ...
Relevant to #3353, I added a option to have a callback just before attaching a screenshot.
Note
I didn't had a closing keyword to this PR, as I don't believe that change alone fixes...
there isnt the plan to add the option to xamarin forms just yet, you can try to use the workaround as in the issue above
and open a feature request to expand it to xamarin via our repo: https://github.com/getsentry/sentry-xamarin/issues
I was just reading the workaround. Can we see what type the View is from the hint argument?
you can inspect the event object
Cool, Thanks
im not super familiar with MAUI to give a more precise code example
That's fine
basically the event object in beforeSend is the event you see in your Sentry project
note that this callback wasn’t shipped yet. will go out on the next release https://github.com/getsentry/sentry-dotnet/blob/main/CHANGELOG.md#features
as Bruno mentioned it won't be available until the next release, but the way you'll be able to use it is by adding an option: ``` options.SetBeforeScreenshotCapture((@event, hint) =>
{
// Return true to capture or false to prevent the capture
return true;
}); ``` you'll be able to programmatically choose to take a screenshot of not by returning `true` or `false`. I submitted a PR for the documentation so hopefully you'll have the doc for the feature on its release
we can make a release at anytime btw. @buoyant quarry can we pull the trigger?