Jump to content
pyscripter

Project Magician gotcha

Recommended Posts

Project Magician is wonderful and a must for all Delphi programmers.   Thank you @Uwe Raabe.

 

However I recently run into the following problem.   As I was debugging, whenever I tried to step into Vcl.Graphics the file would open and get marked as modified.  Moreover stepping into the code would not work.   Also when I opened Vcl.Graphics and some other files in the IDE, it would automatically marked them as modified.   I was puzzled.  I thought this was a new bug in the 10..4.1 Delphi IDE.  But it turns out this was due to a Project Magician, otherwise very useful option to "Clean Line Feeds" under global settings.  Vcl.Graphics has mixed line breaks in Delphi 10.4.1, so whenever it is opened in the IDE it would be automatically marked as modified since the mixed line breaks were detected and marked for fixing.    And then debugging is hampered + you get all these annoying messages about the IDE being unable to create a backup.

 

One suggestion to @Uwe Raabe is that Delphi library files are excluded from line-feed cleaning.

Edited by pyscripter

Share this post


Link to post

Actually I am thinking about some mechanisms for a DO NOT TOUCH! feature in Project Magician. While this is supposed to handle more cases than some Delphi library files only, I am still unsure how to implement it in a flexible as well as easy to handle way.

 

5 hours ago, pyscripter said:

Vcl.Graphics has mixed line breaks in Delphi 10.4.1

I guess, this qualifies for a QP report anyway. Some sort of Clean Linefeeds action before commit/check-in should be mandatory - even for Embarcadero. Not to mention a Format Sources.

Share this post


Link to post

One of the first things I do after a fresh Delphi install is to mark the VCL source read-only. I don't know if that would have prevented it.

  • Like 2

Share this post


Link to post
22 minutes ago, Anders Melander said:

One of the first things I do after a fresh Delphi install is to mark the VCL source read-only. I don't know if that would have prevented it.

Yes, read-only files are out of bounds.

 

The latest version also recovers from any write errors caused by insufficient access rights.

  • Like 1

Share this post


Link to post

I've been doing some testing of the current version and I might be misunderstanding things.  I have a dproj file with a Base config with verinfo information (including <VerInfo_Keys> info.)  I added a new one under Base-Win32 and both seem to stay around.  I was expecting the win32 one to be removed in favor of Base.  Am I misunderstanding how it works?  It did correctly remove the verinfo stuff from a debug section.  Is this so that you can have different version info for different target platforms?  Project Magician is awesome btw! 

 

Edited by MarkShark

Share this post


Link to post
47 minutes ago, MarkShark said:

I added a new one under Base-Win32 and both seem to stay around.  I was expecting the win32 one to be removed in favor of Base.

Which platforms are in your project?

 

There is indeed a different behavior for Windows-only projects and others. If there are other platforms than Win32 and Win64, the base configuration stays as is (usually it then is empty anyway). But perhaps something is just going wrong there.

Share this post


Link to post

My projects platforms are Win32 and Win64.  Am I correct that the Magician actions take place on Project Save?  Basically I'm just switching Targets, changing the version info, then saving the project and then looking at the dproj file to see the results.

 

[added] In my testing with a project that has Win32 and Win64 target platforms only, that Base_Win32 and Base_Win64 retain <verinfo_*> changes when saving the project.

Edited by MarkShark

Share this post


Link to post

Can you send me that dproj file?

 

The version info is handled directly when you save the project options from the dialog - or you change the Project Magician options.

Share this post


Link to post
3 minutes ago, Uwe Raabe said:

Can you send me that dproj file?

 

The version info is handled directly when you save the project options from the dialog - or you change the Project Magician options.

Yes, though I'll make a new test case and retest my findings just in case it's project specific (this particular project is one that's been around for years.)   Thanks for clarifying about when Project Magician does its work!

Share this post


Link to post

I've attached ProjTest.dproj.  I took the following steps:

 

Created a new Vcl project.

Added Target Platform Win64

Used the Project Options Dialog to add version info to "All Configurations - All Platforms" setting version 1.2.3.4 (and also editing the key/values)

Used the Project Options Dialog to add version info to "All Configurations - Windows 32-bit Platform" setting version 5.6.7.8 (and also editing the key/values)

Used the Project Options Dialog to add version info to "All Configurations - Windows 64-bit Platform" setting version 9.10.11.12 (and also editing the key/values)

Also added some debug and release version info for each target.

Save on Project Options

Save Project

Result:  The debug and release verinfo sections were correctly removed.  The Base, Base-Win32 and Base-Win64 sections remain intact (I'm still unsure if that's "as intended" or not.)

 

ProjTest.dproj

 

[added:  I'm using Delphi 10.4.1 and the latest Project Magician.]

Edited by MarkShark

Share this post


Link to post

Does Project Magician support 10.4.1 project files?  Or alternatively, is the command-line program supposed to work if I select none of the IDE options?  If the answer to both of these is 'yes' I will report a null-pointer exception when running the command-line version to try it. 

Share this post


Link to post

@timfrost It doesn't matter if what you do with Project Magician is intended usage or not - it should not crash - period.

 

In case this depends on the project file: Can you send me a copy, please?

  • Like 1

Share this post


Link to post

@Uwe Raabe One issue I had recently was with the IDE crashing badly when going View Form as Text and then back.  I disabled Project Magician and the issue went away.

Using Delphi 10.4.1 and the latest version of Project Magician.

Delphi Magician options:

 

 image.thumb.png.0a754598f1b2746acd4fac4b9050e299.png 

 

The crash also occurred with a fresh VCL application and an empty Form.

Edited by pyscripter

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

×