Thank you for an excellent product! It works very well.
I would like to get stacktrace in Application.OnException for unhandled exceptions:
procedure Tform1.AppException(Sender: TObject; E: Exception);
var s : string;
s := MadStackTrace.StackTrace(true);
// s = '' 15 TForm1.AppException'#$D#$A' ... initialization'
// had hoped to see:
// S= '' 22 Tform1.Button1Click ...'
It seems, that the stack is cleared prior to AppException is called?
I Know, I can make the madshisystem handle unhandled exceptions, but I would like to show the same error dialogue, that I use for handled exceptions (here I can get the correct stack dump)
How do I get the stack dump un unhandled exceptions?
Application.OnException is hooked by madExcept and should not even be called at all. I wonder why/how it's called for you!??
Anyway, you can use madExcept.RegisterExceptionHandler() to be notified about unhandled exceptions. Please be careful with the parameters of that function. They define in which thread context your callback is called. If you want to show your own VCL dialog, you need to be aware of that the VCL is not thread safe. madExcept's own dialogs are all done without VCL, using pure win32 APIs, to make them perfectly thread safe.
All threads in my system are inside try .. except, so the dialog does not need to be thread safe in this case.
Can you link to an example with registerexceptionhandler, where where I can see how to get the stack?
There is a little sample code at the bottom of this page:
However, it runs in a secondary thread because it doesn't need VCL.