Open dorssel opened 2 years ago
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.
For Cleanup:
delete .dotnet-suggest-registration.txt
clear directory content system-commandline-sentinel-files
-?
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.
RegisterWithDotnetSuggest() uses a sentinel file and effectively only (tries to) register once. A good thing in itself, but if the user installs
dotnet-suggest
after 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:
The IntelliSense for the developer (me in this case) isn't very helpful either, as RegisterWithDotnetSuggest() says: "ensures that ...", while nothing is really ensured.