Jump to content
Al T

(replicable w/ source) Why do I always get Access Violation every time I rebuild ANY component? (Current solution is to Restart Delphi.. Why??)

Recommended Posts

For the replicable w/ source see

 

This has been happening for every version of Delphi I've ever owned... it still happens in Delphi 11.0 Enterprise.  The only solution is to restart Delphi for every single change made to the component!

 

Why do I always get Access Violation every time I rebuild a component?

 

I've tried to uninstall / install after every build to the component...save .. open up a project that uses that component ... access violation ... solution Restart Delphi

I've tried to just clean.. build... component...save .. open up a project that uses that component ... access violation ... solution Restart Delphi

 

Why do I need to always restart Delphi (close delphi... then double click delphi to load it again) ... every time I rebuild a component??

 

Is there something that I can do to stop having to Restart Delphi to fix this issue?

 

Any ideas?

Edited by Al T

Share this post


Link to post

Yes you can, before you compile the package uninstall all the packages that depends on that one. That should improve the situation.

 

Unfortunately this is a "known" issue and impossible to report (as it's hard to make the required test case).

 

PS. For a project group I even have a situation that some days Access Violation is almost every time triggered when I compile an application without runtime packages.

Share this post


Link to post
21 hours ago, Lajos Juhász said:

Yes you can, before you compile the package uninstall all the packages that depends on that one. That should improve the situation.

 

Unfortunately this is a "known" issue and impossible to report (as it's hard to make the required test case).

 

PS. For a project group I even have a situation that some days Access Violation is almost every time triggered when I compile an application without runtime packages.

It's easy to replicate.

 

Note: I use right click to clean, right click to build, right click to install, right click to uninstall.  I double left click to select either the Windows 32 bit or Windows 64 bit platforms in the view of the Project Group.

 

Build both Windows 32 and Windows 64 platforms and install the windows 32 bit version (Delphi won't let you install the 64 bit version) of this component: https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/PianoComponent_Install/PackageComponent_PianoKeyboard.dproj

 

save all and close the component project

 

open project https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/Athena.dproj

 

then open up https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/UAthenaVSTForm.fmx

 

You should see the piano component is there.

 

Now ... save all and close all.

 

Go back to the project and open https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/PianoComponent_Install/PackageComponent_PianoKeyboard.dproj

 

uninstall the component

 

now... make changes to line 249 by changing it from https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/PianoComponent_Install/UPianoKeyboard.pas#L249

 

0: Canvas.Fill.Color := TAlphaColorRec.White;

 

to

 

0: Canvas.Fill.Color := TAlphaColorRec.Orange;

 

after making the changes.. save all, then clean for both the windows 32 bit and windows 64 bit platforms... build both windows 32 bit and windows 64 bit platforms of the project and install this component again from https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/PianoComponent_Install/PackageComponent_PianoKeyboard.dproj

 

save all and close this project...

 

go back to the project and open https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/Athena.dproj

 

now open https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/UAthenaVSTForm.fmx

 

You'll get Access Violation every single time!  (It's repeatable)

 

The only solution I found was to restart Delphi.

 

 

You'll get Access Violation and the form fmx will not show up, but you'll see the source code.

 

Proof above it's repeatable.

 

 

Share this post


Link to post

The other solution found was to remove the component from https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/UAthenaVSTForm.fmx

 

then go make changes to the project https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/PianoComponent_Install/PackageComponent_PianoKeyboard.dproj

 

go back to project https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/Athena.dproj

 

then now you have to put the component back on the form, align it where you want it on the form, make changes to the component, etc.  So much extra work to get the component right again and Delphi suppose to be fast and efficient programming!

 

This major bug needs to get fixed ... it's repeatable!

 

Any ideas or work around that doesn't require removing the component from the project that uses it?

 

When Delphi saves... I wonder if it saves any linkage to the old code??  when you open it again... there goes the access violation?  Maybe there is a way to force Delphi to reload all components before opening project?

 

Share this post


Link to post
38 minutes ago, Al T said:

hen now you have to put the component back on the form, align it where you want it on the form, make changes to the component, etc.  So much extra work to get the component right again and Delphi suppose to be fast and efficient programming!

 

  

I simply select the custom control cut and repaste that should keep positions and events intact when "resetting" to see a small change after "tuning".  For a single control I don't mess with the library rebuild. Would that work for you. 

   

OT on your plugin would a @plugin work?    

Share this post


Link to post

So Delphi, in order for this issue to become a big deal, more people will have to report this issue:

 

Sync status from internal system, internal issue closed on Nov 22, 2022 by Marco Cantù with comment:
While the IDE could provide better errors in such a case, if a component in a third party project shows an AV at every compilation, it seems the issue is in the component code – it doesn't happen with other components, to our knowledge. Please check with the original author (if it's not your code) or ask for someone to check the specific code..

 

The only way they will accept there is a Access Violation is if this happens to more than just one person and other components.

 

With any other component, mainly copy my setups in https://en.delphipraxis.net/topic/7842-replicable-w-source-why-do-i-always-get-access-violation-every-time-i-rebuild-any-component-current-solution-is-to-restart-delphi-why/?do=findComment&comment=65699 and I'm sure you'll get a Access Violation with any other component using a single instance of the IDE.

 

It's going to take more than one person with this issue for it to become a issue.

 

 

Share this post


Link to post

Have you tried debugging the component package using a second IDE to see where the AV is being raised - hopefully it will show you a call stack that might help you isolate the issue.

Does an empty package with no component registration cause an AV?

In your component code, do you utilise any INITAILIZATION/FINALIZATION sections in your units to create or destroy objects?

Share this post


Link to post

I think that the owner made some basic mistakes in his project design, at least with regard to the construction and installation of said component. The rest I reserve as a mere spectator!

 

From my perspective, the errors are:

  1. use a system directory as a "target" for your files, whether or not to be compiled!!!
    1. -- recommendation: always create your own directory for your projects, never trust or use operating system directories - even if you are a system administrator;
  2. you are using a "logging" system that makes use of third-party tools in your project, so be aware of providing all source (or compiled) files for all platforms and operating systems necessary so that the future user can compile your projects;
  3. before uploading your projects to a public repository or not, always check that everything is as it should be -- thoroughly check your project's internal settings;
  4. test, test, test... until you can't test it anymore!

I think that your case is solved with this recomendations.... 

in my tests, here, RAD 11.2 Alexandria patch 1, your component and installations was concluded with success.... BUT WITH THE CHANGES NECESSARY HERE SHOWED!!!

 

HOW I did:

  • fixed all little (but indispensable) your basic errors
  • I installed the package
  • I created a new project FMX with your component
  • I uninstalled your package and change the color value as below
  • I installed AGAIN your package
  • I create a new project FMX with your components
  • ALL WITHOUT NEEDS RESTART MY RAD 11.2 IDE!!!
  • I use the folder:  "D:\RMSVST3" to copy your github files... and on "OUTPUT path to DCU" I used "$(Platform)\$(Debug)"  - default usage in Delphi!!!  --- NO MORE "C:\program files...."

 

image.thumb.png.7d7d798cce15fc0ad1e770ad27370140.png

FMX_AthenaVST3.7z

Edited by programmerdelphi2k

Share this post


Link to post

I have exactly the same problem since I have migrated from 10.3.3 (no problem) to 11.2. Full VCL without any FMX framework (IOS,Android MacOS etc.)

Each time I add a new component library I have an access violation. I leave the IDE and restart it add my library and it's ok. But at the next library added => Access violation. First I think it was because of a TMS library. But it was not.

It's easy to reproduce :

Manually install Devexpress, TMS, IBDAC, FastReport library => Sure it's happen !

I think that it's a Delphi 11.2 functionality ? 😉

Edited by FabDev

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×