UnhandledException - No Stack ?

When we hit an “UnhandledException” event in the debugger the exception has the stack trace but the “Stack” pane in the IDE doesn’t have the stack.

Would it be possible to show the stack here? It would make debugging these exceptions a lot easier.

You’ve hit the unhandled exception handler in the app class ?

If so then quite literally there IS no stack to show - as exception handling has unwound it trying to find a handler

This would require the “CameFrom” statement which doesn’t exist

I think the problem is that I always turn of break on exceptions because I often throw exceptions intentionally and its a nightmare to run your debug program with this on. From my understanding this is the way Xojo is moving as a framework too. The problem is if you don’t have “Break On Exceptions” turned on then you can’t see the stacktrace and variable values when the exception makes it to the UnhandledException event.

It would be ideal if there was a sort of “Break For UnhandledExceptions” setting that every time an exception is thrown while debugging, it would peek where the catch is going and if it makes it to the “UnhandledException” event then break on the exception so we can see what is happening with the actual variables and where.

  • 1

[quote=167386:@Brock Nash]
It would be ideal if there was a sort of “Break For UnhandledExceptions” setting that every time an exception is thrown while debugging, it would peek where the catch is going and if it makes it to the “UnhandledException” event then break on the exception so we can see what is happening with the actual variables and where.[/quote]

Problem is you and the compiler and runtime, have no idea its unhandled until you get to App.Unhandled exception and by then its far too late

If you write your catches like

  catch ex as <specific exception type>

  catch rte as RuntimeException
      break

and catch the ones you expect then the second catch will catch “everything else”
you do have to watch for EndException and a few others that maybe you want to ignore but you have control of it

Would it be possible for the debugger to make the .Stack value available when you inspect the exception?

That’s why I was hoping you guys could make the debugger “peak” ahead for this.

[quote=167399:@Norman Palardy]and catch the ones you expect then the second catch will catch “everything else”
you do have to watch for EndException and a few others that maybe you want to ignore but you have control of it[/quote]

Can you explain this a bit more? How do we have control over it? I couldn’t find a way in the preferences to control what exceptions we break on.

That’s a good idea. Please file a feedback request.

[quote=167404:@Brock Nash]
How do we have control over it? I couldn’t find a way in the preferences to control what exceptions we break on.[/quote]
There isn’t a “break only on this exception but not this one” setting
You can toggle break on exceptions with a pragma but thats local
Otherwise you write code. In the editor.

He meant re-raise the ones you don’t want to handle.

<https://xojo.com/issue/38183>