Exception not caught when project is on network drive

delphi package - automated exception handling
A. Balslev
Posts: 15
Joined: Fri Apr 06, 2012 2:40 pm

Exception not caught when project is on network drive

Post by A. Balslev »

Mad except ver. 5.0.0
Delphi Rio
I develop in Delphi 10.3.3 running on a virtual machine (VMware)
I save project files on a shared drive on host
I enable MadExcept on the project.
By executing "raise Exception.Create('Error Message');" I expected madExcept to catch this, but it doesn't

By saving the åroject on a local drive on my VM it works.

Any suggestions?
br.

Anders Balslev
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception not caught when project is on network drive

Post by madshi »

Is it the linking itself which seems to not work correctly? Or is it just the path where the files are executed? E.g. if you link in the same way you did when it failed to work, and if then copy the "failed" EXE over to the local drive, does it work then?
A. Balslev
Posts: 15
Joined: Fri Apr 06, 2012 2:40 pm

Re: Exception not caught when project is on network drive

Post by A. Balslev »

Consider a Delphi project is located on a test folder on a HOST computer (carrying a VM)
On the VM, I map the project folder to a "Z:\"-drive


On the VM, Delphi 10.3.3 is running.
I open the project specified by "\\MyHost\MyProjectFolder\MyProject.dproj"

Build it
Run it.

MadExcept catches the exception

I close it

I open the the project specified by "Z:\MyProjectFolder\MyProject.dproj"

Build it
Run it

MadExcept does NOT catch the exception.

Same project in the 2 cases - just addressed on different ways.

Very strange
Attachments
2 identical projects
2 identical projects
Madshi_1.PNG (5.48 KiB) Viewed 10351 times
Project2_NonMapped.zip
Using non-mapped drive Madexcept works
(6.3 KiB) Downloaded 253 times
Project2_Mapped.zip
Using mapped drive Madexcept doesnt work
(6.4 KiB) Downloaded 257 times
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception not caught when project is on network drive

Post by madshi »

What happens if you build the project using Z:\, but then run it through the Explorer using the UNC path? Does it work then or fail?

Basically I want to know if it's the compiling or the running which is the problem.
A. Balslev
Posts: 15
Joined: Fri Apr 06, 2012 2:40 pm

Re: Exception not caught when project is on network drive

Post by A. Balslev »

In both cases I do as follows:

Build
Go to the windows explorer, and double click on the ,EXE file, means running from windows explorer

If you want to look at it, I could share my screen. If so - send a direct mail

br.

Anders
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception not caught when project is on network drive

Post by madshi »

It seems you don't understand what I'm aiming at. I'm now asking for the 3rd time in a row:

Is it the compiling (to Z:\ vs UNC) or the running (from Z:\ vs UNC) which is the problem?

You can test this by compiling to Z:\ and then running from UNC. Or by compiling to UNC and then running from Z:\.
A. Balslev
Posts: 15
Joined: Fri Apr 06, 2012 2:40 pm

Re: Exception not caught when project is on network drive

Post by A. Balslev »

Compiling to Z:
Running from Z: -->Problem
Running from UNC --> Problem

Compiling to UNC
Running from Z: --> No problem
Running from UNC --> No problem

br.

Anders
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception not caught when project is on network drive

Post by madshi »

Ok, thanks. So clearly compiling is the problem, not running. Can you please create an empty file named "madExceptWizard.txt" on your desktop, then start Delphi and compile to Z:. Afterwards the madExceptWizard.txt file should be filled. Now please rename the file to "problem.txt". Then please stop Delphi. Create another empty file named "madExceptWizard.txt", start Delphi and compile to UNC. Please rename the file to "ok.txt". Finally, please upload the files somewhere for me to look at.
A. Balslev
Posts: 15
Joined: Fri Apr 06, 2012 2:40 pm

Re: Exception not caught when project is on network drive

Post by A. Balslev »

I have created the 2 files (OK.txt and Problem.txt) which are both filled.

I can't upload it since "The extension txt is not allowed." (why?)

Can I send them directly at to an e-mail
br.

Anders
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception not caught when project is on network drive

Post by madshi »

I'm not sure, maybe if you zip them you can upload them here? Not sure how I configured the forum, to be honest.

You can also send them to me directly, or upload them to a file host, e.g. MediaFire.
A. Balslev
Posts: 15
Joined: Fri Apr 06, 2012 2:40 pm

Re: Exception not caught when project is on network drive

Post by A. Balslev »

madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception not caught when project is on network drive

Post by madshi »

Those 2 files look almost identical. It seems that madExceptPatch.exe (which is the tool which does some additional patching on your EXE file after the Delphi compiler & linker have run through) believes that patching suceeded just fine. So I'm at a loss right now to understand what's going on.

Can you please upload the two EXE files as "problem.exe" vs "ok.exe"? I don't need to be able to execute them, I just want to look at their resource section and file size etc, to check if I can see a meaningful difference somehow.
A. Balslev
Posts: 15
Joined: Fri Apr 06, 2012 2:40 pm

Re: Exception not caught when project is on network drive

Post by A. Balslev »

Uploaded to same one-drive server:
https://itqconsult-my.sharepoint.com/:f ... Q?e=Ceikvd
2 executable files
2 new OK_2 and Problem_2 txt-files

br.

Anders
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Exception not caught when project is on network drive

Post by madshi »

Can't see anything wrong, both look nearly identical... :shock: And one of these works and one doesn't?

I guess the only thing you could do now is try to debug madExcept.pas by setting breakpoints and trying to figure out why it doesn't work when compiled to Z:\. In order to set breakpoints you need to copy "madExcept.pas" and "mad.inc" into your project folder and then recompile. First breakpoint to set might be in madExcept.HandleException().

It's all very weird, to be honest.

Of course alternatively you could always compile using the UNC path. But it shouldn't be necessary. Not sure what's going on...
A. Balslev
Posts: 15
Joined: Fri Apr 06, 2012 2:40 pm

Re: Exception not caught when project is on network drive

Post by A. Balslev »

Yes - very strange.
Try to run both executables, and click on button1
Problem : Just a messagebox showing an exception
OK : The wellknown MadExcept dialog box shows up

I'll try to follow your instructions

br.
Anders
Post Reply