-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
Crash in [SentrySubClassFinder actOnSubclassesOfViewControllerInImage] (SentrySubClassFinder.m:61) #3798
Comments
@dimacorp, I tried to reproduce your problem in our iOS-Swift sample application by adding the following class @available(iOS 17.0, *)
class RoomCaptureTools {
func doSomething() {
}
} but I couldn't reproduce the issue. The Please share more details on your project setup and how you include Sentry, so we can reproduce the problem. |
The app is quite big and actually mostly in ObjC but please try to add this line to RoomCaptureTools, it looks it's essential as CapturedStructure is from the new API:
and please make sure to run with older iOS (we do with 15.5). |
Ah, importing RoomPlan and using it like this does the trick. I can reproduce the problem now:
Using canImport doesn't solve the problem.
|
The same problem exists also for ActivityKit: import ActivityKit
@available(iOS 17.0, *)
class SomeClass {
private var activity : PushType?
func doSomething() {
}
} When looking at your stacktrace, the culprit seems to be in the Swift runtime somewhere around #1 0x00000001043eb498 in type metadata accessor for CapturedStructure? ()
#2 0x00000001043eb3ac in type metadata completion function for RoomCaptureTools ()
#3 0x000000018f9c7930 in swift::MetadataCacheEntryBase<(anonymous namespace)::SingletonMetadataCacheEntry, int>::doInitialization(swift::MetadataWaitQueue::Worker&, swift::MetadataRequest) ()
#4 0x000000018f9b8cf8 in swift_getSingletonMetadata ()
#5 0x00000001043eb360 in type metadata accessor for RoomCaptureTools ()
#6 0x00000001043eb314 in ObjC metadata update function for RoomCaptureTools ()
#7 0x000000018017d938 in realizeClassMaybeSwiftMaybeRelock(objc_class*, mutex_tt<false>&, bool) ()
#8 0x0000000180183548 in look_up_class ()
#9 0x00000001807e7cb8 in NSClassFromString () My first guess was that this could be a bug in the latest Swift version, but I can also reproduce the problem with Xcode 15.1 / Swift 5.9 and Swift 4.2. Anyways, For now, you can disable the swizzling logic via sentry-cocoa/Sources/Sentry/Public/SentryOptions.h Lines 361 to 369 in b15521e
|
One idea for another workaround is to provide an ignore list for classes to swizzle, so you would have to do something like
for every class that imports |
Thanks for taking a look, at this point we disabled Sentry for iOS < 17, turning off swizzling might work but disables a number of features, swizzleIgnoreList sounds like a better idea. |
Add an option to exclude certain classes from swizzling. Fixes GH-3798
@dimacorp, we will add options.swizzleClassNameExcludes = ["RoomPlanWrapper"] We are also going to add the workaround to our troubleshooting section in the docs with getsentry/sentry-docs#9596. |
Add an option to exclude certain classes from swizzling. Fixes GH-3798
Add an option to exclude certain classes from swizzling. Fixes getsentryGH-3798
Add an option to exclude certain classes from swizzling. Fixes getsentryGH-3798
Platform
iOS
Environment
Production, Develop
Installed
CocoaPods
Version
8.22.4
Did it work on previous versions?
No response
Steps to Reproduce
import RoomPlan
@available(iOS 17.0, *)
class RoomCaptureTools {
private var finalResults: CapturedStructure?
}
This class is a helper class to a feature available on latest iOS while the app itself supports iOS 13
Expected Result
no crash
Actual Result
The app crashes in SentrySDK startWithConfigureOptions
Are you willing to submit a PR?
No response
The text was updated successfully, but these errors were encountered: