Search Unity

Bugsnag and Unity... stack trace issue

Discussion in 'Scripting' started by cpuRunningHot, Sep 16, 2020.

  1. cpuRunningHot

    cpuRunningHot

    Joined:
    May 5, 2018
    Posts:
    94
    I am integrating bugsnag for my project and I'm encountering some inconsistencies with the stack traces for thrown exception. Given the following code...

    Code (CSharp):
    1.             Bugsnag.Notify(new Exception("Manually reporting exception from main thread"));
    2.             throw new NullReferenceException("Throwing exception from main thread");
    manually reporting the error via Bugsnag.Notify() reports a proper stack trace, while throwing an exception loses all but the method from which it is called...

    upload_2020-9-16_12-4-3.png


    To add to the mystery, if I throw an exception from a thread, I do get a proper stack trace.

    Has anyone encountering this issue? Solution?
    Thx in advance :D
     
  2. ZackTW

    ZackTW

    Joined:
    Sep 23, 2020
    Posts:
    1
    @cpuRunningHot I am experiencing the same issue and considering wrapping parts of my code with try blocks, but given that Unity controls most of the input paths (to Start/Update, etc), this seems like an exercise in futility.

    I'd love to know if you have come up with a better solution since September?
     
  3. cpuRunningHot

    cpuRunningHot

    Joined:
    May 5, 2018
    Posts:
    94
    I've since put it to the back of my mind. I do remember trying a few different techniques, one of which was to set autoNotify to false, and manually process the exceptions via Bugsnag.Notify().

    I think I settled on a strategy of catching as many exceptions as I can and manually processing them, but leaving the autoNotify on so it will catch all others. A very unsatisfactory solution, but I had to move on. If you come up with a solution, please let me know ( as will I/you when I revisit the topic )