getsentry / sentry-cocoa

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

Missing part of crash message #3905

Open sindresorhus opened 6 months ago

sindresorhus commented 6 months ago

Platform

macOS

Environment

Production

Installed

Swift Package Manager

Version

8.24.0

Did it work on previous versions?

No response

Steps to Reproduce

Some code crashes in production for violating the Swift Hashable requirement.

Crash report: https://sindresorhus.sentry.io/share/issue/ab8eb435cc71469082a07cdbece72d70/

Expected Result

I expected to see the full error message.

Actual Result

Sentry only shows part of it, making it impossible to track down the issue.

Sentry shows:

' were found in a Dictionary.

While it should have shown:

Duplicate keys of type 'SomeKeyType' were found in a Dictionary.

Kinda looks like some sanitizing going wrong.

Are you willing to submit a PR?

No response

philipphofmann commented 6 months ago

Thanks for reporting this. I can reproduce the issue by adding the following code to our iOS-Swift sample app and running a release build on an iOS simulator.

var dict = [Something() : "value", Something() : "value"]

for _ in 0..<100 {
    dict[Something()] = "value \(1)"
}

class Something :Hashable {

    private var x: Int = 0

    static func == (lhs: Something, rhs: Something) -> Bool {
        return true
    }

    func hash(into hasher: inout Hasher) {
        hasher.combine(Int.random(in: 0..<100))
    }
}
sindresorhus commented 6 months ago

Another example (also Hashable violation):

EKCale > Fatal error > Stack overflow in (null)

Interestingly, this one doesn't show the were found in a Dictionary. part at all. And EKCale is a cut off EKCalendar.

https://sindresorhus.sentry.io/share/issue/0e4faa9089734b2bbe498a1e876fb30e/