Calling method that caused error

  1. 2 months ago

    Tim K

    May 10 Pre-Release Testers, Xojo Pro

    I am having problems tracking down an error that does not occur in the debugger.
    I am getting an NillObjectException that falls through to unhandledexception to prevent a crash.
    I can't remember how get the calling method that caused the error.

    TIA

    Tim

    Not sure if this will get me what I want but this is what I was looking for CurrentMethodName

  2. scott b

    May 10 Pre-Release Testers, Xojo Pro local coffee shop

    look at the stack.. that should give you a clue. the "exception" (I think it is referenced as e in that event handler but that is from memory so it is probably wrong) has a few things that can help you. look at each of them and display as many as you can either in System.Debuglog or a textfile or somewhere that you can review.

  3. Tim K

    May 14 Pre-Release Testers, Xojo Pro Answer

    Not sure if this will get me what I want but this is what I was looking for CurrentMethodName

  4. Tim S

    May 15 Canterbury, UK

    Trouble is that doesn't give you the method causing the exception, though that may be near the top of the stack. It just tells you you are in App.UnhandledException.

  5. Tim H

    May 15 Pre-Release Testers Portland, OR USA

    app.UnhandledException is called directly from the method that caused the exception, so there should be no ambiguity about the stack. And it is often useful to know the entire call sequence.

  6. Tim S

    May 16 Canterbury, UK

    @Tim H app.UnhandledException is called directly from the method that caused the exception, so there should be no ambiguity about the stack. And it is often useful to know the entire call sequence.

    Agreed, and in my app.UnhandledException handler I write the whole stack to a log file. Even then it's nice to have a summary message that just says for example "Unhandled NilPointerException in myMethod".

  7. Tim H

    May 16 Pre-Release Testers Portland, OR USA

    Which you can do. Probably just two ways of doing the same thing. Putting it in UnhandledException might save the effort of putting it in each method individually.

or Sign Up to reply!