Rubberduck.Extension should add CommandLineSafe DWORD value

Created on 2 Mar 2018  路  10Comments  路  Source: rubberduck-vba/Rubberduck

From https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/the-selected-add-in-has-not-been-confirmed-to-be-command-line-safeand-may-requir

"Command-line safe" means that the add-in is registered in a way to indicate that it contains no user interfaces that require user input when Visual Basic is invoked through a command-line. A user interface can interfere with the operation of unattended processes (such as build scripts). If you don't indicate that an add-in is command-line safe (even if it is command-line safe), when a user selects your add-in and then Command Line in the Load Behavior box, they'll receive the warning message. This isn't a serious problem, but merely a warning to the user that the selected add-in might possibly contain UI elements that can pop up unexpectedly and halt their automated scripts by pausing for user input. To specify that an add-in is command-line safe, author it that way (you can use the Add-In designer for this), or manually change the value in the registry key.

vbWatchdog does it, so it must be good.

When implemented, the value must be applied to both 32 and 64-bit keys - see #3816

installer vb6-specific

Most helpful comment

vbWatchdog does it, so it must be good.

Lol, that made me chuckle. No, vbWatchdog does it because Wayne simply re-used the code from the VB6 branch :)

So AFAIK it's not applicable to VBA.

All 10 comments

Hmm. I'm not sure this applies to a VBA add-in. The linked article seems to me misplaced because when I google, I see references to VB6 add-ins.

For example:

Referencing Add-In (for VB6

Add-In Registration (for Visual Studio add-in)

And then we have this...

How to build an Office COM Add In by using Visual C#

ext_cm_CommandLine: The add-in is connected from the command line. Note that this does not apply to building COM add-ins for Office applications.

Do we know if this applies to non-Office VBA hosts? Otherwise I don't see a need until we actually implement VB6 support?

Maybe @WaynePhillipsEA can explain why it's used in vbWatchdog?

I think there is another piece of evidence that CommandLineSafe simply doesn't apply to VBA hosts -- the MZ Tools 3.0 and Watchdog both has the parameter set. However, when viewing via the add-in manager, the Command Line option which is always greyed out is persistently blank, in spite of having the key. That indicates to me that VBE isn't bothering to read the key despite having a checkbox for it (which I assume was borrowed from VB6 which do support that setting).

As far as I know that setting is ignored / has no effect whatsoever in the VBA IDE. Doesn't hurt to have it I guess... Fun fact: early RD builds did specify that value, it was removed specifically because useless in VBA.

Given that the VB6 Addins has their own separate path apart from VBA Addins, I'm going to say YAGNI until we actually enable VB6 support.

maybe even have VBA/VB6/VB5 as installation options, once we need them.

Re-opening this now that we have VB6 support where this makes sense.

I will add the necessary registry key. However, I do not think I can set it as command safe line because we by default display a splash screen and when something goes wrong, it will pop open a dialog which will block until user dismiss the dialog. For that reason, it is not appropriate to claim command line safety unless we additionally make adjustment to the startup code to handle this case.

vbWatchdog does it, so it must be good.

Lol, that made me chuckle. No, vbWatchdog does it because Wayne simply re-used the code from the VB6 branch :)

So AFAIK it's not applicable to VBA.

With VB6 support we should consider a command-line startup sequence that doesn't wire up the UI and its various commands, and allows running all tests & outputting results and messages to stdout; ditto for code inspections.

Until we can do either, the flag should remain at 0. If possible CommandLineSafe should only exist in the VB6 add-in registration, since it's useless in VBA.

Closing this for now, as the flag is set to 0 (not command-line-safe) in #3959.

Will open a new issue for actually implementing a command-line safe switch for VB6.

Was this page helpful?
0 / 5 - 0 ratings