Can not make it work

delphi package - automated exception handling
Post Reply
sanjayk
Posts: 12
Joined: Tue Oct 01, 2013 3:15 am

Can not make it work

Post by sanjayk »

I have used and licensed MadExcept before (v3). Today, for the first time I want to use it on a C Builder XE4 project. But it doesn't work.

Here is what I did:
1) Installed MadExcept 4 (unchecked Kernel, etc in the installer and only installed MadExcept4).

2) Restarted C ++ Builder XE4 and the project.

3) Enabled MadExcept on Project MadExcept setttings.

4) Rebuilt the project.

5) Ran it. The error still gives original access violation message and the MadExcept dialog doesn't pop up. Deliberately created an access violation in code and it still doesn't show its dialog.

What can be wrong? Where to start looking?

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

Re: Can not make it work

Post by madshi »

Unfortunately there's a bug in XE2+. The release mode RTL.lib and VCL.lib have incomplete debug information. That results in madExcept not being able to find some RTL/VCL functions it needs to patch. I had reported this bug to Embarcadero after XE2 was released, but to my best knowledge it's still not fixed... :(

There are a few workarounds available for this problem:

(1) Compile in debug mode. You can even modify debug mode to do the same as release mode. It will still work, while release mode doesn't.
(2) Copy RTL.lib and VCL.lib from the XE4 "debug" directory to the XE4 "release" directory.
(3) Add an Application.OnException handler which then calls madExcept.HandleException.

I'd recommend (1) and (2) because solution (3) only partially fixes the issue, while (1) and (2) should be more complete solutions.
sanjayk
Posts: 12
Joined: Tue Oct 01, 2013 3:15 am

Re: Can not make it work

Post by sanjayk »

But I am testing in Debug mode. I have run time dynamic library switched off in packages and also in linker. But still it doesn't bring up the MadExcept dialog.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Can not make it work

Post by madshi »

I've just tried the following:

(1) Started BCB XE4.
(2) Created a new VCL project.
(3) Dropped a button on the main form.
(4) In the ButtonClick event I raised an exception.
(5) Enabled madExcept.

Works just fine here. Can you double check this?
sanjayk
Posts: 12
Joined: Tue Oct 01, 2013 3:15 am

Re: Can not make it work

Post by sanjayk »

Creating a new project works fine. But not with the project I'm compiling. Actually, it's just a sample project for a third party component that is giving access violation and I want to see what MadExcept shows. I tried to compare the CBproj files but found nothing. If you want, I can email you the cbproj file to see if something is not right. I have seen bugs related to configurations in XE products for versioninfo.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Can not make it work

Post by madshi »

The only thing that would help would be if I could reproduce the problem on my PC. Is that possible?
sanjayk
Posts: 12
Joined: Tue Oct 01, 2013 3:15 am

Re: Can not make it work

Post by sanjayk »

Giving you the project won't help because it needs the component too. Can I give a compiled EXE to you with MadExcept linked in that is supposed to work? Then you can see how it doesn't bring up madexcept instead of access violation? If yes, please tell me which email to send it to. I will zip it up before sending.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Can not make it work

Post by madshi »

That won't help, I'd have to be able to recompile myself.

Does that 3rd party component come with as DCU/OBJ/LIB, so you can link it directly into your EXE? Or does it come as a DLL? Which language is this 3rd party component compiled with?

madExcept only cares about unhandled exceptions. If that 3rd party component catches its own exceptions and then shows its own message box, madExcept won't get active. Maybe that is the cause of the problem?
sanjayk
Posts: 12
Joined: Tue Oct 01, 2013 3:15 am

Re: Can not make it work

Post by sanjayk »

But I have deliberately created a problem in the main form itself and that itself is showing normal Access Violation. The actual problem I want to diagnose and send to component developer has taken a back seat because I can't even get MadExcept to work with my own created problem. I think it has something to do with the project file and its configurations getting messed up, a typical problem in XE4.

I will recreate the project and see if I can get it to work. I will post here.

Thanks,
Sanjay
sanjayk
Posts: 12
Joined: Tue Oct 01, 2013 3:15 am

Re: Can not make it work

Post by sanjayk »

OK. Success at last! When I created a new project and added the original units to it, it worked with MadExcept. So it turned out once again of the configuration mess up of XE4. This is the Nth time I'm seeing such problems. I had problems with versioninfo not working, manifest inclusion not working and so on. Each time I had to do some tinkering with the xml of the project file. This time, I had no idea what went wrong. I still have the original project file in case you want to compare.

Anyway, thanks for the follow up, that too on a weekend. BTW, is there some upgrade discount for upgrading to the latest MadExcept from commercial 3 license?

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

Re: Can not make it work

Post by madshi »

Glad to hear you got it working! Yeah, C++ configuration can be a mess. I'm often fighting with that, too. Not only in BCB, but also in MSVC++.

The upgrade pricing on the website already contains the discount. Without your commercial 3 license you'd have to buy a full new license, which is more expensive, of course.
Post Reply