Can you get an exception after the end of the main application?

In one of our applications, I get an exception that I cannot find or catch.

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

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

All I can think of is the completion code for one of the blocks.

(Delphi 7)

+4
source share
4 answers

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

This helped me when I had a similar problem.

+4
source

Here are two things you can try:

1) Quick and easy - press "F7" on the end "end". This will lead you to other refinement blocks.

2) Try to override the Application.OnException event.

+4
source

The SysUtils block actually sets the default ErrorProc and ExceptProc procedures in the initialization section and cancels them in the completion section, so in this situation it is often worth making sure that SysUtils is the very first element in the uses clause in your dpr, so it will be the last to be completed. It may be enough to get some meaningful evidence about what is going wrong.

+4
source

Final exceptions are complex. Even if you first put SysUtls in your project file, your application object may already disappear, which means that your global exception handler is gone too. MadExcept may work for this though.

Another solution is to install the Try / Except block in each section of the finalization , and then handle the exceptions.

What is your goal? Do you want to suppress the exception or debug it? Debugging can be done by navigating through them using F7 , as suggested by Zartog. If you find which unit has an exception in the finalization , you can try placing it in a different order in the announcement from which it is called.

Good luck

+2
source

Source: https://habr.com/ru/post/1277145/


All Articles