getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
815 stars 330 forks source link

fix: Missing UIViewController traces with Xcode 16 #4523

Closed philipphofmann closed 2 weeks ago

philipphofmann commented 2 weeks ago

:scroll: Description

Xcode 16 introduces a new flag ENABLE_DEBUG_DYLIB. If this flag is enabled, debug builds of app and app extension targets on supported platforms and SDKs will be built with the main binary code in a separate “NAME.debug.dylib”. Our swizzling logic for UIViewControllers sometimes skipped swizzling the UIViewControllers in that debug.dylib binary. This is fixed now, by swizzling all matching inAppInclude binary images that the binary image cache returns and not only the first one.

:bulb: Motivation and Context

A customer reported this problem.

:green_heart: How did you test it?

Unit tests and sample app with Xcode 16.

:pencil: Checklist

You have to check all boxes before merging:

:crystal_ball: Next steps

github-actions[bot] commented 2 weeks ago

🚨 Detected changes in high risk code 🚨

High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.516%. Comparing base (4509e9c) to head (ac5db3b). Report is 1 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523/graphs/tree.svg?width=650&height=150&src=pr&token=PTZKtOJlrs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry)](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) ```diff @@ Coverage Diff @@ ## main #4523 +/- ## ============================================= + Coverage 91.513% 91.516% +0.003% ============================================= Files 615 615 Lines 69460 69512 +52 Branches 24896 24924 +28 ============================================= + Hits 63565 63615 +50 - Misses 5802 5804 +2 Partials 93 93 ``` | [Files with missing lines](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Δ | | |---|---|---| | [Sources/Sentry/SentryBinaryImageCache.m](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523?src=pr&el=tree&filepath=Sources%2FSentry%2FSentryBinaryImageCache.m&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-U291cmNlcy9TZW50cnkvU2VudHJ5QmluYXJ5SW1hZ2VDYWNoZS5t) | `100.000% <100.000%> (ø)` | | | [Sources/Sentry/SentrySubClassFinder.m](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523?src=pr&el=tree&filepath=Sources%2FSentry%2FSentrySubClassFinder.m&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-U291cmNlcy9TZW50cnkvU2VudHJ5U3ViQ2xhc3NGaW5kZXIubQ==) | `94.545% <100.000%> (+0.101%)` | :arrow_up: | | [Sources/Sentry/SentryUIViewControllerSwizzling.m](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523?src=pr&el=tree&filepath=Sources%2FSentry%2FSentryUIViewControllerSwizzling.m&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-U291cmNlcy9TZW50cnkvU2VudHJ5VUlWaWV3Q29udHJvbGxlclN3aXp6bGluZy5t) | `90.070% <100.000%> (+0.142%)` | :arrow_up: | | [...troller/SentryUIViewControllerSwizzlingTests.swift](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523?src=pr&el=tree&filepath=Tests%2FSentryTests%2FIntegrations%2FPerformance%2FUIViewController%2FSentryUIViewControllerSwizzlingTests.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-VGVzdHMvU2VudHJ5VGVzdHMvSW50ZWdyYXRpb25zL1BlcmZvcm1hbmNlL1VJVmlld0NvbnRyb2xsZXIvU2VudHJ5VUlWaWV3Q29udHJvbGxlclN3aXp6bGluZ1Rlc3RzLnN3aWZ0) | `99.328% <100.000%> (+0.089%)` | :arrow_up: | | [...ests/SentryTests/SentryBinaryImageCacheTests.swift](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523?src=pr&el=tree&filepath=Tests%2FSentryTests%2FSentryBinaryImageCacheTests.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-VGVzdHMvU2VudHJ5VGVzdHMvU2VudHJ5QmluYXJ5SW1hZ2VDYWNoZVRlc3RzLnN3aWZ0) | `100.000% <100.000%> (ø)` | | ... and [9 files with indirect coverage changes](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry). Last update [4509e9c...ac5db3b](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4523?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry).
github-actions[bot] commented 2 weeks ago

Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1216.98 ms 1245.76 ms 28.78 ms
Size 22.30 KiB 730.30 KiB 708.00 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
6bc5ae5e4f3e1fb4414ab1b0643ffc3ec87ded1f 1207.23 ms 1216.66 ms 9.43 ms
65e48e054c6878001f9d146e8006e6f2114139e4 1223.68 ms 1238.96 ms 15.28 ms
5616e0a239f7f0d4255197a901318c62d7c82833 1224.12 ms 1249.86 ms 25.74 ms
6943de0faec429fe6e29ae8c9cdb31770ad05e94 1230.02 ms 1235.32 ms 5.30 ms
3db3e35c43af949b9d27185b9c534adf0c38fdde 1233.52 ms 1256.43 ms 22.90 ms
aea59877317b2d37269e169717c17311683d98d7 1223.84 ms 1244.39 ms 20.55 ms
ed49f0c45e853d078735099abd82315b08ebb099 1245.67 ms 1261.15 ms 15.48 ms
20a828b2b971ed044ce4af19b653ba516dde5c3c 1211.33 ms 1228.00 ms 16.67 ms
af1f4dd2342784c9d799dececf5cd16596847e32 1225.39 ms 1245.48 ms 20.09 ms
50bb751cfe50189673d3c0ec5b0d664659218ade 1234.10 ms 1248.29 ms 14.19 ms

App size

Revision Plain With Sentry Diff
6bc5ae5e4f3e1fb4414ab1b0643ffc3ec87ded1f 20.76 KiB 401.39 KiB 380.63 KiB
65e48e054c6878001f9d146e8006e6f2114139e4 21.90 KiB 708.34 KiB 686.44 KiB
5616e0a239f7f0d4255197a901318c62d7c82833 22.85 KiB 407.44 KiB 384.59 KiB
6943de0faec429fe6e29ae8c9cdb31770ad05e94 20.76 KiB 393.33 KiB 372.57 KiB
3db3e35c43af949b9d27185b9c534adf0c38fdde 21.58 KiB 419.21 KiB 397.63 KiB
aea59877317b2d37269e169717c17311683d98d7 21.58 KiB 418.13 KiB 396.54 KiB
ed49f0c45e853d078735099abd82315b08ebb099 21.58 KiB 632.13 KiB 610.55 KiB
20a828b2b971ed044ce4af19b653ba516dde5c3c 21.58 KiB 670.99 KiB 649.41 KiB
af1f4dd2342784c9d799dececf5cd16596847e32 22.85 KiB 414.71 KiB 391.86 KiB
50bb751cfe50189673d3c0ec5b0d664659218ade 21.58 KiB 417.86 KiB 396.27 KiB

Previous results on branch: fix/missing-xcode-16-ui-view-controller-traces

Startup times

Revision Plain With Sentry Diff
c002ee08d744a93d63ba815cd6e9f945697aacdb 1221.09 ms 1227.81 ms 6.73 ms

App size

Revision Plain With Sentry Diff
c002ee08d744a93d63ba815cd6e9f945697aacdb 21.90 KiB 730.30 KiB 708.39 KiB
github-actions[bot] commented 2 weeks ago

🚨 Detected changes in high risk code 🚨

High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these: