You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RegisterWithDotnetSuggest does not work if dotnet-suggest is installed later #1588
RegisterWithDotnetSuggest() uses a sentinel file and effectively only (tries to) register once. A good thing in itself, but if the user installs dotnet-suggestafter the System.CommandLine application, then the registration fails (of course) and is never attempted again.
This requires the user to either run dotnet-suggest register explicitly, or remove the (obscure, undocumented) sentinel file.
This is not an uncommon scenario:
software states "supports command completion"
user installs software and finds out command completion does not work
user seeks help and finds out dotnet-suggest + shim need to be installed
user install dotnet-suggest + shim as instructed
command completion still does not work, as the software never attempts to register again
The IntelliSense for the developer (me in this case) isn't very helpful either, as RegisterWithDotnetSuggest() says: "ensures that ...", while nothing is really ensured.
To add some scenarios here, as I just analyzed some strange behaviour:
If the user moved the executable, after it was registered, the completition is no longer possible
e.g. download a zip file with a command, first extract it to some temp location, execute it, test it, later on move it to another location.
also i observed, that after registering for dotnet-suggest, i needed to open a new powershell in order to get the completition.
To be complete (for my own lookup later)
%USERPROFILE%\.dotnet-suggest-registration.txt
executable full path which is registered.
%TEMP%\system-commandline-sentinel-files
sentinel files location, once a file is located here, no new registration is possible.
Damn! Thank you @BobSilent !!! I was just banging my head against a wall wondering WTF?!? I followed your steps and my app now has completion support. This is a pretty bad bug... hopefully it gets prioritized.
A similar scenario: I build a command-line application and run it from the bin/Debug directory. It registers itself with dotnet suggest, and tab completion works in PowerShell. Then I build the Release configuration of the same version and run it from the bin/Release directory. It does not register itself because the assembly name matches the sentinel file that was created for the debug binary. Tab completion does not work.
Activity
BobSilent commentedon May 6, 2022
To add some scenarios here, as I just analyzed some strange behaviour:
If the user moved the executable, after it was registered, the completition is no longer possible
e.g. download a zip file with a command, first extract it to some temp location, execute it, test it, later on move it to another location.
also i observed, that after registering for dotnet-suggest, i needed to open a new powershell in order to get the completition.
To be complete (for my own lookup later)
%USERPROFILE%\.dotnet-suggest-registration.txtexecutable full path which is registered.
%TEMP%\system-commandline-sentinel-filessentinel files location, once a file is located here, no new registration is possible.
For Cleanup:
-?KyleKolander commentedon May 19, 2022
Damn! Thank you @BobSilent !!! I was just banging my head against a wall wondering WTF?!? I followed your steps and my app now has completion support. This is a pretty bad bug... hopefully it gets prioritized.
KalleOlaviNiemitalo commentedon Jun 21, 2022
A similar scenario: I build a command-line application and run it from the
bin/Debugdirectory. It registers itself withdotnet suggest, and tab completion works in PowerShell. Then I build the Release configuration of the same version and run it from thebin/Releasedirectory. It does not register itself because the assembly name matches the sentinel file that was created for the debug binary. Tab completion does not work.KalleOlaviNiemitalo commentedon Mar 27, 2025
RegisterWithDotnetSuggest was removed in #2099, so this issue is no longer valid.