D11.3, Win 11, 32 bit Apps, Delphi opened DPIUnaware.
I have a ShowMessage at the start of the GX_CodeFormatterExpert.pas Execute method.
I am experiencing random non function of the Source Code Formatter.
If I start my Windows and immediately open Delphi and a Project, in most cases the Formatter is fine.
If I close the Project and open another, sometimes the Formatter does not work either via the HotKey or the menu option. Sometimes it does.
Closing and reopening the Project and Delphi sometimes restores functionality, sometimes not.
Closing the Project and Delphi and restarting Windows seems to always make it work the first time.
Sometimes, if I already have other Apps open and then open Delphi, the Formatter does not work immediately.
In all cases the ShowMessage appears, but randomly as described, the Formatter does NOT do its thing.
I have tried all sorts of permutations but nothing seems to be permanent.
I do NOT recall this happening in D11.2 but it may have. If it did, it wasn't as frequent/annoying.
This could be my overall Windows environment. I don't know.
It could be something specifi to D11.3. I don't know.
It may be something to do with the changed IDE in 11.3. I don't know.
If there is any value I am happy for you to remote into my PC and observe/test if you like.
Regards,
Ian
I have just committed revision #3989 containing additional debug messages that should help tracking down the reason for the failure. Please update your sources and compile a new DLL in debug mode(!). Then, the next time formatting failed, check the topmost entries in the GExperts debug window (in the icon tray). And copy them here. Please start with the line saying
TeCodeFormatterExpert.Execute
and include all lines above that start with the string "GXFormatter:".
A successful format call should look something like this:
2 GXFormatter: TCodeFormatterExpert.Execute:Cleanup 11:29:14
2 GXFormatter: TCodeFormatterExpert.Execute:Force repaints 11:29:14
2 GXFormatter: TCodeFormatterExpert.Execute:Restore breakpoints and bookmarks 11:29:14
2 EditorViewModified(D:\source_sourceforge\GExperts\source\Formatter\GX_CodeFormatterExpert.pas) 11:29:14
2 GXFormatter: TCodeFormatterExpert.Execute:Replace selection only 11:29:14
2 GXFormatter: TCodeFormatterExpert.Execute:Executing formatter 11:29:14
2 GXFormatter: TCodeFormatterExpert.Execute:Prepare to format selection 11:29:14
2 GXFormatter: TCodeFormatterExpert.Execute:Format selection ? 11:29:14
2 GXFormatter: Use default settings 11:29:14
2 GXFormatter: TCodeFormatterExpert.Execute:Determine settings 11:29:14
2 GXFormatter: TCodeFormatterExpert.Execute:Save Breakpoints and bookmarks 11:29:14
2 GXFormatter: Formatting requested for "D:\source_sourceforge\GExperts\source\Formatter\GX_CodeFormatterExpert.pas" 11:29:14
2 GXFormatter: TCodeFormatterExpert.Execute 11:29:14
2 TeCodeFormatterExpert.Execute 11:29:14
Hi Thomas,
Build of 3990 failed..See attached screen shot.
That looks like you had merge conflicts.
I deleted the GExperts directory and redownloaded the source. Now the errors look like the attached..
You did not build it with the debug configuration. (It's a bug nonetheless, but it does compile with the debug config).
OH! My apologies. I missunderstood.
Whilst I will take it as a compliment, I'm afraid I don't have the level of expertise you assumed/expected me to have. - Apologies.
I have downloaded rev 3997 & built the .dll in debug mode.
I then built GExpertsDebugWindows.exe and ran it. Not quite sure when/where it is supposed to show.
Anyway, after 30 minutes of testing so far the Formatter hasn't failed.
I will return here and advise if it does.
I am missing something.. :-(
I have GExpertDebugWindows running. I can see it in Windows Task Manager.
I added dbugintf to my uses clause..
I added " SendDebug('Debug note');" into the FormShow.
When I run the App, no debug window appears so I don't see any message.
What have I missed??
Ian
Nor does any Debug window appear when I call the Formatter.
I have spent the day in and out of Delphi and multiple mixtures of other Apps.
Not once has Formatter failed me. :-) Nor have I seen the GExperts Debug Window.
Tomorrow morning I will build GExperts via the normal way and test it for the day.
Will advise.
Ian
I think the GExpers debug window will sit on SystemTray (Or what it is
called), don't remember if you need to specifically to open it from the
Tray icon to see it.
-Tee-
On Mon, Mar 13, 2023 at 6:16 AM Ian Branch ijbranch@users.sourceforge.net
wrote:
Related
Bugs:
#314Ah Ha! got it. Tks Tee.
Glad to see that my memory serves someone :)
-Tee-
On Mon, Mar 13, 2023 at 8:14 AM Ian Branch ijbranch@users.sourceforge.net
wrote:
Related
Bugs:
#314Hi Thomas,
Results of a lot of back and forth testing..
Regards,
Ian
Aside from when I was testing, I have used GExperts built in Debug mode most of yesterday and all of today without any issuse or hiccups withthe Formatter.
Hm, that's odd. Maybe disabling debug everywhere but keeping the messages might help. I'll try to produce some more testing code today.
Interesting: I can reproduce the problem now on my computer. That might be good news.
This is, what the log looks like, when formatting fails:
(Note: The EditorViewModified might be missing only because debugging was disabled and therefore no message was sent to the debug window. Or it might be missing because it was never called.)
Last edit: Thomas Mueller 2023-03-18
Here is the reason:
1 Formatter: EListError: List index out of bounds (-1). TList object range is 0..-1 15:26:42
This results in TCodeFormatterEngine.Execute to return False.
But why that doesn't happen in debug mode is still a mystery.
@ijbranch : I have just committed some changes that logs any exceptions that happen in TCodeFormatterEngine.Execute, regardless whether compiled in debug mode or not.
Please use that to verify that an exception there is the cause for the code formatter failing on your computer. (And of course, please report that exception here).
Hi Thomas,
Build of rev 4002 failed when built via the __build_project.. See attached.
It also fails if built directly in Release mode. I commented out the offending lines and it builds.
I will test both modes today and advise.
Ian
A merge conflict again.
The about dialog may need some adjustment. :-)
Edit - Sorted after I did a clean download.
Last edit: Ian Branch 2023-03-18
I got one...
This is with GExperts built in Release mode.
Hmmm..
Edit - Sorted after I did a clean download.
Last edit: Ian Branch 2023-03-18
Did you change something already??
I did a clean download of GExperts.
I no longer get the 'Release' or 'Debug' during startup or in the About box.
Edit - S'OK - I figured out what you have done.
Last edit: Ian Branch 2023-03-18