Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell commented Aug 14, 2025

Resolves #4439:

Summary

In applications with complex user interfaces consisting of hundreds of controls on any individual page, the overhead of adding and removing events hooks to all of the VisualElement.Loaded events can cause significant performance delays.

We use this event hook to set the Masking behaviour for visual controls of or descending from a particular type (controlled via NativeSentryReplayOptions.MaskControlsOfType<T>() and NativeSentryReplayOptions.UnmaskControlsOfType<T>()).

This PR:

  1. Only adds this binders that set masking behaviour by type if the MaskControlsOfType or UnmaskControlsOfType options are used
  2. Adds a warning to both the Sample and the XML docs for those methods to make people aware of the performance implications

@jamescrosswell jamescrosswell marked this pull request as ready for review August 14, 2025 22:19
@jamescrosswell jamescrosswell self-assigned this Aug 19, 2025
cursor[bot]

This comment was marked as outdated.

@jamescrosswell
Copy link
Collaborator Author

@Flash0ver it's lucky I took another look at this on the back of our chat yesterday. I had things completely backwards. See updated description in this PR and updated code.

It's maybe worth considering whether we want to offer the MaskControlsOfType and UnmaskControlsOfType options at all (given the performance risks/considerations). Although worth noting that these options are present in the Java implementation... so it would be nice to offer these for people that don't have crazy user interfaces. They do make things way more conventient:

options.Native.ExperimentalOptions.SessionReplay.UnmaskControlsOfType<Button>();

@jamescrosswell jamescrosswell changed the title Only detect custom session replay masks when necessary Only register MauiSessionReplayMaskControlsOfTypeBinder when relevant Aug 21, 2025
{
services.AddSingleton<IMauiElementEventBinder, MauiCustomSessionReplayMaskBinder>();
}
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that untrue because

  • the BindableProperty does set the tags for native (""sentry-mask"" and "sentry-unmask") already
  • where the IMauiElementEventBinder must now do the same for all configured MaskedControls/UnmaskedControls

?
(just clarifying if I'm understanding it)

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

This was referenced Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MAUI Performance Issue
4 participants