Skip to content

RegisterWithDotnetSuggest does not work if dotnet-suggest is installed later #1588

Closed as not planned

Description

@dorssel

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:

  • 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.

Activity

  1. added
    bug
    Area-Completions
    on Jan 19, 2022
  2. added this to the 2.0 GA milestone on Feb 19, 2022
  3. BobSilent commented on May 6, 2022

    @BobSilent
    Contributor

    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
    
    1. open a new shell
    2. call exe with e.g. -?
    3. open new shell => tab completition works
  4. KyleKolander commented on May 19, 2022

    @KyleKolander

    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.

  5. modified the milestones: 2.0 GA, 2.1 on Jun 9, 2022
  6. KalleOlaviNiemitalo commented on Jun 21, 2022

    @KalleOlaviNiemitalo

    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.

  7. KalleOlaviNiemitalo commented on Mar 27, 2025

    @KalleOlaviNiemitalo

    RegisterWithDotnetSuggest was removed in #2099, so this issue is no longer valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Completionsbug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions