Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you Catch an Exception after the main application unit has ended?

In one of our application im getting an exception that i can not seem to find or trap.

...
  Application.CreateForm(TFrmMain, FrmMain);
  outputdebugstring(pansichar('Application Run')); //this is printed
  Application.Run;
  outputdebugstring(pansichar('Application Run After')); //this is printed
end.
<--- The Exception seems to be here    

The Event log shows

> ODS: Application Run 
> //Various Application Messages 
> ODS: Application Run After
> First Change Exception at $xxxxxxxx.  ...etc

All i can think of is it is the finalization code of one of the units.

(Delphi 7)

like image 214
Christopher Chase Avatar asked Dec 08 '22 09:12

Christopher Chase


2 Answers

Try installing MadExcept - it should catch the exception and give you a stack-trace.

It helped me when I had a similar issue.

like image 80
Blorgbeard Avatar answered Jun 03 '23 00:06

Blorgbeard


Here's two things you can try:

1) Quick and easy is to to hit 'F7' on the final 'end.'. This will step you into the other finalization blocks.

2) Try overriding the Application.OnException Event.

like image 28
Zartog Avatar answered Jun 02 '23 23:06

Zartog