microsoft / plcrashreporter

Reliable, open-source crash reporting for iOS, macOS and tvOS
Other
2.88k stars 537 forks source link

Unknown Objective C Exception: instrumentation could not capture original exception. #324

Open ManoharaReddyP opened 1 week ago

ManoharaReddyP commented 1 week ago

Description

We are using C++ library in our swift project which has below functions

void CPPTerminateSetHandler(CPPExceptionHandler handler) { set_terminate(handler); }

I want to understand is there anyway to block this C++ termination handler, or say, is there any way to expose the original NSException.

Currently getting below error message: Unknown Objective C Exception: instrumentation could not capture original exception. instead of displaying original

Repro Steps

Please list the steps used to reproduce your issue.

  1. Create sample cpp project and add above lines in cpp
  2. Add this as dependency to sample app and call cpp functions

    DemoLib.setCplusplusTerminateHandler { print("Hello, Exception!") }

Details

  1. Which SDK version are you using? 1.11.0

  2. Which OS version did you experience the issue on? 15.2 but seems like it's reproduce in all version

  3. Which CocoaPods/Carthage/Xcode version are you using? -> SPM

  4. What device version did you see this error on? Were you using an emulator or a physical device? -> Simualtor

  5. What language are you using?

    • Objective C
    • Swift
  6. What third party libraries are you using? No

IlyaBausovAkvelon commented 3 days ago

Hi, thank you for reporting! Do you disable Xcode's debugger? What is the class CPPExceptionHandler? What does it do? How do you use PLCrashReporter in this particular scenario?

ManoharaReddyP commented 3 days ago

Hi @IlyaBausovAkvelon,

No we did't disabled Xcode debugger

CPPExceptionHandler is a mechanism typically used in cross-platform mobile applications to handle C++ exceptions that occur in native code, particularly in environments where Objective-C, Swift is used as the main application code but C++ library imported for some functionality. in this case exception being thrown from c++ using below code

(void)setCplusplusTerminateHandler:(CPPExceptionHandler)handler { CPPTerminateSetHandler(handler); }

that library being used in Objective-C project where we use PLCrashReporter to fetch crash reports and show meaning full info but seems like PLCrashreporter does't handle this exception it shown message like below

Screenshot 2024-10-04 at 3 20 48 PM