getsentry/sentry-cocoa

Missing part of crash message

Opened this issue · 2 comments

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

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))
    }
}

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/