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

Map iOS Native BeforeSend & OnCrashedLastEvent to SentryOptions.Native #3958

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

aritchie
Copy link
Collaborator

@aritchie aritchie commented Feb 11, 2025

Resolves #2102

@aritchie aritchie mentioned this pull request Feb 12, 2025
@aritchie
Copy link
Collaborator Author

@jamescrosswell @bruno-garcia Native exceptions obviously teardown the MAUI apps. I can't unit test this properly due to needing to shutdown the app. Thoughts? Any internal mechanism I can call in native to have it "pretend" an issue occurred previously and force run BeforeSend/CrashedLastRun

@bitsandfoxes
Copy link
Contributor

bitsandfoxes commented Feb 14, 2025

Over at https://github.com/getsentry/sentry-unity/ we're covering this via smoketests which to me seems more reliable to guarantee native-crash capture.
Two runs:

  1. Running and crashing on purpose
  2. Running again and expecting the crashedLastRun to be true

@jamescrosswell
Copy link
Collaborator

@jamescrosswell @bruno-garcia Native exceptions obviously teardown the MAUI apps. I can't unit test this properly due to needing to shutdown the app. Thoughts? Any internal mechanism I can call in native to have it "pretend" an issue occurred previously and force run BeforeSend/CrashedLastRun

I think the CrashedLastRun mechanism will ultimately be checking to see if there's an envelope for a crash report somewhere right? So that we could fake/mock?

@aritchie
Copy link
Collaborator Author

I think the CrashedLastRun mechanism will ultimately be checking to see if there's an envelope for a crash report somewhere right? So that we could fake/mock?

Can't really fake/mock the native layer though. This is smoke tested in the iOS sample app.

@aritchie aritchie marked this pull request as ready for review February 18, 2025 16:39
@aritchie aritchie marked this pull request as draft February 18, 2025 23:13
@aritchie
Copy link
Collaborator Author

This PR also now resolves #735 and #3944

@aritchie aritchie marked this pull request as ready for review February 21, 2025 16:05
Copy link
Collaborator

@jamescrosswell jamescrosswell left a comment

Choose a reason for hiding this comment

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

Generally looking good.

I think we might be able to refactor the code dealing with the OnBeforeSend event into a BeforeSendWrapper, like what was done for Android. That would make it easier/possible to write unit tests for all of that logic (and prevent regressions in the future).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants