-
-
Notifications
You must be signed in to change notification settings - Fork 325
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(apple): Disable enableNativeCrashHandling
and enableAutoPerformanceTracing
#2936
Conversation
โฆutoPerformanceTracing'
Thank you for the PR, We have a few tests for the method |
Hey @krystofwoldrich thanks for your message. I added some tests and can confirm that without my changes, I had to add following line inside RNSentry.mm to check the state of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thank you @mwerder and @birdofpreyru ๐
enableNativeCrashHandling
and enableAutoPerformanceTracing
on Apple
enableNativeCrashHandling
and enableAutoPerformanceTracing
on AppleenableNativeCrashHandling
and enableAutoPerformanceTracing
Glad I could contribute. Thanks for your help @krystofwoldrich ๐ |
fix cast to BOOL for sentry init options 'enableNativeCrashHandling' and 'enableAutoPerformanceTracing'
๐ข Type of change
๐ Description
Environment:
XCode: 14.2
sentry/react-native: ^5.2.0
platform: MacOS Catalyst & iOS
I integrated sentry into our react-native catalyst app for MacOS.
While building I ran into following errors:
"cast from pointer to smaller type 'bool' (aka 'signed char') loses information"
on following lines inside RNSentry.mm:
ln:111
BOOL enableNativeCrashHandling = (BOOL)[mutableOptions valueForKey:@"enableNativeCrashHandling"];
ln:122
BOOL enableAutoPerformanceTracing = (BOOL)[mutableOptions valueForKey:@"enableAutoPerformanceTracing"];
I'm not familiar with objective-c and its types. As the type BOOL behaves differently on 32 and 64-bit machines, I thought that was the problem. But both, iOS and MacOS are 64-bit systems.
So I cannot figure out why it works on iOS but it throws an error on MacOS.
What I found out after testing though, is that with the existing cast, the options enableNativeCrashHandling and enableAutoPerformanceTracing are always true even if I set them to false inside the Sentry.init() options (test cases 5 and 6 below failed with the existing code using the (BOOL) cast).
By debugging I can confirm that following if statement is never entered when setting enableNativeCrashHandling to false:
๐ก Motivation and Context
Fixes catalyst build and allows options enableNativeCrashHandling & enableAutoPerformanceTracing to be disabled on iOS
The solution is based on following answer on Stack Overflow
๐ How did you test it?
I ran tests locally while running the app on iOS and macOS. Tested all options using console.logs to verify the options are set correctly.
As mentioned above, using the existing code I always get true. So test case 5 and 6 are failing.
This would mean that it is not possible to disable AutoPerformanceTracing and NativeCrashHandling.
I tried to look into the test cases but honestly, I'm not sure where to add them as the options seems to be mocked.
Would this need an e2e test to verify the iOS code?
closes: #2944
๐ Checklist
sendDefaultPII
is enabled๐ฎ Next steps
Maybe add test cases for options.