Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MAUI missing breadcrumbs for lifecycle and UI events #2170

Merged
merged 3 commits into from
Feb 9, 2023

Conversation

mattjohnsonpint
Copy link
Contributor

@mattjohnsonpint mattjohnsonpint commented Feb 9, 2023

I'm really not sure when this started happening, but I noticed that we are no longer getting any breadcrumbs for lifecycle and UI events in MAUI apps.

Running our MAUI sample shows only these:

image

The two breadcrumbs before the exception are from logging that the MAUI sample does, and are picked up by Sentry.Extensions.Logging. There's no indication of Application, Windows, or Button events as there used to be.

The last time I worked on this part of the MAUI code was with #2001 / #2006. It's possible the issue was introduced then. If so, I'm surprised we didn't notice until now. It's also possible that something changed in MAUI between then and now.

On investigation, it seems that MAUI's IPlatformApplication.Application property is not set until after the event we use. See here in the MAUI source code.

Thus, there are two options:

  1. Bind at a later event, after the Application property has been resolved
  2. Resolve the Application property ourselves through the Services container.

This PR takes the second approach, which appears to work:

image

I also went back and validated that this didn't regress #2001.

@mattjohnsonpint mattjohnsonpint merged commit e354b4f into main Feb 9, 2023
@mattjohnsonpint mattjohnsonpint deleted the fix/maui-events branch February 9, 2023 16:29
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.

None yet

2 participants