swiftsentryprintstacktrace

Sentry: Event is missing number lines in stack trace


I am using Sentry for error logging in my app. General functionality works fine, however it doesn't contain number line in stack trace so it's hard to recognize source of the problem. Normally it shows method names but it comes more difficult if it's some response from Alamofire request in another thread. Example event:

OS Version: iOS 14.1 (19H114)
Report Version: 104

Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: ILL_NOOP at 0x000000010b1edc34
Crashed Thread: 0

Application Specific Information:
Fatal error > <appName>/IssuesViewController+Sync.swift > Unexpectedly found nil while unwrapping an Optional value

Thread 0 Crashed:
0   libswiftCore.dylib              0x10b1edc34         _assertionFailure
1   libswiftCore.dylib              0x10b1ed786         _assertionFailure
2   libswiftCore.dylib              0x10b1ed462         _assertionFailure
3   libswiftCore.dylib              0x10b1ed0e0         _assertionFailure
4   <appName>                       0x20976243e         IssuesViewController.manualSync
5   <appName>                       0x2097622a3         IssuesViewController.didGetAccounts
6   <appName>                       0x2095e2223         FMDBManager.saveAllAccounts
7   <appName>                       0x209761e3f         IssuesViewController.didGetAccounts
8   <appName>                       0x209581038         RequestService.getAllAccounts
9   Alamofire                       0x10a74bd61         DataRequest.response<T>
10  Alamofire                       0x10a705830         @callee_guaranteed
11  libdispatch.dylib               0xfffe4020835a      _dispatch_call_block_and_release
12  libdispatch.dylib               0xfffe40209533      _dispatch_client_callout
13  libdispatch.dylib               0xfffe40216010      _dispatch_main_queue_callback_4CF
14  CoreFoundation                  0xfffe406d1275      __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
15  CoreFoundation                  0xfffe406cbb05      __CFRunLoopRun
16  CoreFoundation                  0xfffe406cab9d      CFRunLoopRunSpecific
17  GraphicsServices                0xfffe56f23db2      GSEventRunModal
18  UIKitCore                       0xfffe480f040e      -[UIApplication _run]
19  UIKitCore                       0xfffe480f531f      UIApplicationMain
20  <appName>                       0x20985d2eb         main
21  libdyld.dylib                   0xfffe404ad408      start

Current configuration:

SentrySDK.start(options: [
    "dsn": dsn,
    "environment": environment,
    "debug": false
])

I've also tried adding

"attach-stacktrace": true

to options but it's enabled by default so there's no difference here.

Error capturing (actually with debug option enabled it prints in the console with included number line):

SentrySDK.capture(error: error) // as NSError

Currently using Sentry-Cocoa with version 7.0.0. Should I configure somehow else my SentrySDK configuration to process line number as well?


Solution

  • Please make sure that you upload your dSYMs (debug symbols) for every release build so Sentry can unscramble Apple’s crash logs to reveal the function, file names, and line numbers of the crash.

    The attachStacktrace is enabled per default. This flag controls if you want to attach the stacktrace for every event you capture. For exceptions and crashes, the SDK always attaches the stacktrace. There is no need for you to enable this manually.

    I recommend using the following start method. It gives you code completion.

    SentrySDK.start { options in
        options.dsn = "YOUR_DSN"
        options.debug = true
    }