Exception only caught in Delphi IDE, but not in the EXE

delphi package - automated exception handling

Exception only caught in Delphi IDE, but not in the EXE

Postby caps » Tue Oct 27, 2020 11:29 am

Hi,

I've searched this board and found this topic 2 times, but the solutions don't apply for me. Therefore I came to the point of posting it again hoping I can find a way to solve the issue.

Conditions
Delphi version 5.0
madExcept version 4.0.21

I've created a blank application with nothing more than a button which does the following to create an exception:
Code: Select all
integer(nil^) := 0;


Now when I compile the program with disabled madExcept the exe file size is about 200kB. When I enable madExcept and compile the exe file size is about 700kB so I suppose the exe is successfully patched by madExcept.

Issue
- When I start the compiled exe and click on the button I get a standard Windows error message saying "[...] write of address 00000000". Nothing else.
- When I start the program within the Delphi Environment with [F9] and press the button following happens:
1) I get a Delphi exception message and the program halts on the position of the assignment as above.
2) I press [F9] again.
3) The program form apperars again (goes on running) and the desired madExcept error message appears with the bug report.

So what can be wrong with the compiled exe file?

Furtherly
According to hints from other posts I have already attached the file madExceptWizard.txt from my desktop which I emptied and then compiled the project with madExcept enabled (I had to rename it to .zip to be able to upload it here :confused: )


Thanks in advance for any help!

Best regards
Caps
Attachments
madExceptWizard.zip
actually a txt file
(16.34 KiB) Downloaded 30 times
caps
 
Posts: 8
Joined: Mon Oct 26, 2020 3:32 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby madshi » Tue Oct 27, 2020 11:33 am

The log file doesn't seem to indicate that madExcept was notified that the compilation has succeeded. Do you have the Delphi 5 update packs installed? It seems really weird, though, that it would work when started within the IDE but not when started outside. I can't recall this being reported before.

In any case, madExcept 4 is outdated. Have you tried madExcept 5?
madshi
Site Admin
 
Posts: 10303
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby caps » Tue Oct 27, 2020 11:38 am

Thanks for the immediate answer!
No, I've not yet tried madExcept 5, but will immediately try it.
So I should deinstall madExcept 4 and remove any remainders of it in the file system first and then install mE5, or can I just install it over the previous version?
caps
 
Posts: 8
Joined: Mon Oct 26, 2020 3:32 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby madshi » Tue Oct 27, 2020 11:42 am

You should be able to just install it over madExcept 4.
madshi
Site Admin
 
Posts: 10303
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby caps » Tue Oct 27, 2020 11:53 am

Hm,

unfortunately it did not help. I've installed madExcept 5, deleted everything in the project except from the .dpr, .pas and .dfm and recompiled the project. Same problem.
I've attached madExceptWizard.zip (txt) again in this post.

:(
Attachments
madExceptWizard.zip
(19.8 KiB) Downloaded 30 times
caps
 
Posts: 8
Joined: Mon Oct 26, 2020 3:32 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby caps » Tue Oct 27, 2020 11:58 am

Interesting:

For some reason I started the program within the IDE, and afterwards I started the compiled exe.
In this case the mE message window appeared also in the compiled exe.
BUT:
When I went back to Delphi, made some settings in the mail area of mE and recompiled the exe, then the compiled exe showed the standard Windows box again, instead of the mE window... (?)
caps
 
Posts: 8
Joined: Mon Oct 26, 2020 3:32 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby madshi » Tue Oct 27, 2020 12:12 pm

So starting the EXE inside of the IDE makes it work outside? Can you reproduce that?
madshi
Site Admin
 
Posts: 10303
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby caps » Tue Oct 27, 2020 12:25 pm

Ideed it seem so.
I did the following:

1.) Disable madExcept for the project.
2.) Save the project
3.) Compile the project (exe file about 200kB).
4.) Start the compiled exe and press the button.
Result: Standard Windows box

5.) Enable madExcept for the project.
6.) Save the project.
7.) Compile the project (exe file about 700kB).
8.) Start the compiled exe and press the button.
Result: Standard Windows box

9.) Start the project within Delphi IDE and press the button.
Result: Delphi exception
10.) Press [F9]
Result: Program goes on running AND madExcept window appears (desired behaviour).

11.) Press "continue application" and quit the program by clicking [x].
12.) Start the compiled exe and press the button.
Result: madExcept window appears (desired behaviour).

:o

D'you have an idea?
caps
 
Posts: 8
Joined: Mon Oct 26, 2020 3:32 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby madshi » Tue Oct 27, 2020 12:49 pm

When not running the program within the IDE, you're still compiling it within the IDE? Or are you compiling it a different way (e.g. command line, or some other tool)?

What happens if you enable madExcept, save the project, then close the project, reopen the project, compile. Does it work then?
madshi
Site Admin
 
Posts: 10303
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby caps » Tue Oct 27, 2020 12:58 pm

I compile the project always in the IDE, no command line tool or anything.

I've tried the steps as you suggested:

1) Enable madExcept
2) Save the project.
3) Close the project (not Delphi)
4) Reopen the project
5) Compile the project
6) Start the compiled exe file (700kB) and press the button.
Result: unfortunately standard Windows box appears
caps
 
Posts: 8
Joined: Mon Oct 26, 2020 3:32 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby madshi » Tue Oct 27, 2020 1:15 pm

This all makes sense only if running the EXE inside of the IDE actually results in another recompile. Does that happen?

Do you have the Delphi 5 Update Pack installed?
madshi
Site Admin
 
Posts: 10303
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby caps » Tue Oct 27, 2020 1:44 pm

Goddamnit! :D

I noticed that the size of the compiled exe changes after I pressed the "OK"-Button in Delphi which tells me that the compilation has been done successfully.
Hm... before I obviously just let that notification box open for me to know that the project had compiled.
Now it seems to work the way it should.

Well... in that notification box of Delphi should not be written "Ready. Compile done." - that reads as "Ready. Compile done."
Otherwise it should be written as "Ready. Compile done, but wait: in case some post compilation steps are still to be done you'd better press the OK button, or your program will not work as desired." :wink:

:redBalloon:

Thanks for your help, I think this issue is fixed.
It also seems to work in my "real" application where I first stumbled over it.

Greeties!
Caps
caps
 
Posts: 8
Joined: Mon Oct 26, 2020 3:32 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby madshi » Tue Oct 27, 2020 1:58 pm

I've configured Delphi to auto-close that box on success... :D
madshi
Site Admin
 
Posts: 10303
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception only caught in Delphi IDE, but not in the EXE

Postby caps » Tue Oct 27, 2020 2:01 pm

Good idea, I should do that too... :-)
caps
 
Posts: 8
Joined: Mon Oct 26, 2020 3:32 pm


Return to madExcept

Who is online

Users browsing this forum: No registered users and 16 guests