Never close last error Topic is solved

Report problems with documented functionality
apolonas
Posts: 43
Joined: 30 Apr 2014, 11:50

Never close last error

28 Jun 2023, 18:17

When an error happens debugger opens a window when i click reload or continue it doesn't close this window and i end up with a lot of useless debugging windows open.
image.png
image.png (88.62 KiB) Viewed 693 times
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: Never close last error

29 Jun 2023, 17:30

It is by design that Reload (regardless of how it is invoked) does not terminate the current instance. The new instance of the script terminates the old instance only if it loads successfully ...
If the script cannot be reloaded -- perhaps because it has a syntax error -- the original instance of the script will continue running.
Source: Reload - Syntax & Usage | AutoHotkey v2
... and the old instance has a main window by which to detect it.
Previous instances of the script are identified by the same mechanism as for #SingleInstance, with the same limitations.
Source: Reload - Syntax & Usage | AutoHotkey v2
Previous instances of the script are identified by searching for a main window
Source: #SingleInstance - Syntax & Usage | AutoHotkey v2
A script which has failed to load due to a syntax error does not have a main window, because it is not yet in a state where the window is useful and safe to use.

However, this is not the Reload function.

Closing the dialog automatically is "useful" as a minor convenience, and perhaps to avoid confusing an old error with a new one. On the other hand, the details shown in an error dialog generally are useful, and having them taken away unexpectedly is definitely not useful.

If you have a run-time error dialog and no syntax errors have been added to the source code, reloading the script will indirectly cause the dialog to close. That being the case, there probably aren't many users who will click the button expecting the dialog to stay on the screen. I'd guess that there are more users who would prefer it to close. It isn't documented either way.

Although this isn't a bug, strictly speaking, I have decided to change the Reload button to unconditionally close the dialog in the next bug-fix release. If the dialog is displaying a run-time error and the script fails to reload, the old instance will stay running but the dialog will have closed.
apolonas
Posts: 43
Joined: 30 Apr 2014, 11:50

Re: Never close last error

30 Jun 2023, 07:46

The problem starts when the debugger keeps the same bug window and opens the same bug window multiple times (if you reload). I think we need 1 bug window at all times and when the script runs successfully close all debugging windows automatically (or have an option for that). You can look at my screenshot I have 4 windows with the same bug. Also I find annoying this 1
image.png
image.png (28.93 KiB) Viewed 597 times
I place return in purpose so I can do some testing and i have this pop up all the time . It forces me to comment everything out so I don't have this window all the time. I know the option

Code: Select all

#Warn All, Off
but it will disable all the warnings, I believe we need the option to disable specific window warnings for example

Code: Select all

#Warn return, Off
Thanks for your time and for the amazing work you put on this all this years.
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: Never close last error

30 Jun 2023, 19:43

What you describe is outside the scope of what a single instance of the program should do.

I think what you're referring to as "the debugger" doesn't exist. Each error dialog is standalone and manages itself only in response to your input. Each instance of the program shows a single (load-time) error or warning at a time, and is independent of all other instances, except with regard to Reload and #SingleInstance.

Editors such as VS Code (with thqby's extension) and SciTE4AutoHotkey can override the error-reporting behaviour. Personally I find the error dialog to be more useful than what VS Code prints, but at least error messages printed to the console don't need to be dismissed.

Anyway, I already said I would change the dialog behaviour, and I already made the change.
when the script runs successfully close all debugging windows automatically (or have an option for that)
In AutoHotkey, most options are implemented by writing code. You already have multiple options: WinClose and GroupClose.
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: Never close last error  Topic is solved

08 Jul 2023, 02:24

v2.0.4 implements the change I mentioned.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 7 guests