App.UnhandledException better stack info

In App.UnhandledException, I’m trying to harvest info using this:

Dim type As String = Introspection.GetType(Error).Name sCrashStack = error.ErrorNumber.ToText + EndOfLine + error.Message + type + error.Reason + EndOfLine + Join(error.Stack, EndOfLine)
The idea is that the user can then report/email me this info so that I can fix things more easily.

However, I get information like this:

9
Illegal Character at position 188JSONExceptionIllegal Character at position 188
XojoFramework$6123
XojoFramework$7181
XojoFramework$7178
XojoFramework$6084
XojoFramework$128
___ZL32_NSURLConnectionDidFinishLoadingP16_CFURLConnectionPKv_block_invoke
__65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke
-[NSURLConnectionInternalConnection invokeForDelegate:]
-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]
-[NSURLConnectionInternal _withActiveConnectionAndDelegate:]
_ZL32_NSURLConnectionDidFinishLoadingP16_CFURLConnectionPKv
___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke
___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2
_dispatch_client_callout
_dispatch_block_invoke
___dispatch_block_create_block_invoke
_ZN19RunloopBlockContext13_invoke_blockEPKvPv
CFArrayApplyFunction
_ZN19RunloopBlockContext7performEv
_ZThn16_N19RunloopBlockContext24multiplexerClientPerformEv
_ZN17MultiplexerSource7performEv
_ZN17MultiplexerSource8_performEPv
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
__CFRunLoopDoSources0
__CFRunLoopRun
CFRunLoopRunSpecific
CFRunLoopRunInMode
RunCurrentEventLoopInMode
ReceiveNextEventCommon
_BlockUntilNextEventMatchingListInModeWithFilter
_DPSNextEvent
-[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
XojoFramework$1290
XojoFramework$1291
XojoFramework$9787
XojoFramework$1290
-[NSApplication run]
XojoFramework$9789
RuntimeRun

or

0 OutOfBoundsException RaiseOutOfBoundsException listGetCellTag XojoFramework$7491 XojoFramework$11138 XojoFramework$1831 -[NSTrackingArea mouseMoved:] -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] -[NSWindow(NSEventRouting) sendEvent:] XojoFramework$1742 -[NSApplication(NSEvent) sendEvent:] XojoFramework$1288 XojoFramework$1289 XojoFramework$9803 XojoFramework$1288 -[NSApplication run] XojoFramework$9805 RuntimeRun
With this, I know what the error is but no idea what method caused it and/or where it’s coming from. Now I can guess and start wrapping everything up in Try…Catch and filling a global so I can eventually get it back but that’s quite a hassle for a rather large project.
Is there a smarter way to gather information?

Ideally, I would like to know what statement raised the exception. Or at least the method. I looked into CurrentMethodName but I somehow need to access the previous/parent/caller method name because CurrentMethodName will always be App.UnhandledException.

Do you have Include Function Names checked in the shared build settings?

Ah, much better. Now I know what that switch is for. :slight_smile:
Thanks!