Calling method that caused error

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

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.

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

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.

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”.

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.