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
dotnet-suggest either no results at all or an error #794
I haven't been able to get dotnet-suggest working> My command is listed by dotnet-suggest list however use yields nothing, example ./mycmd.exe <TAB> yields nothing (it will just list the files in the directory) when I actually have several top level commands (attached to root).
I tried it with with dotnet ef <TAB> and it errored oddly - it said something about index outside array, and the error actually filled the command prompt line so that if I pressed the up arrow it would take me line by line through the exception message.
Let me know if there is any other information I can gather for you.
btw the version:
post -- dotnet-suggest.exe --version
1.1.110402+ee740ce93caef56482d900984746ae86c205fa7e
dotnet-ef
dotnet ef
dotnet-suggest
dotnet suggest
mkmrk.cli
So I assumed dotnet-ef was a valid command to try for dotnet-suggest
Directory no.1 (has no .csproj file in it) = try dotnet-ef.exe <TAB> adds to the same line as I typed dotnet-ef.exe <TAB> : No project was found. Change the current working directory or use the --project No project was found. Change the current working directory or use the --project option.
Directory no.2 (does have a .csproj) with no appended .exe =
dotnet-ef
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.String.get_Chars(Int32 index)
at Microsoft.EntityFrameworkCore.Tools.RootCommand.<>c.<Execute>b__11_0(String a)
at System.Linq.Enumerable.TakeWhileIterator[TSource](IEnumerable`1 source, Func`2 predicate)+MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute()
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0()
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Index was outside the bounds of the array.
Directory no.2 with .exe appended:
It slows down a ton and then repeated prints:
dotnet-ef.exe .\
Build started... Specify --help for a list of available options and commands.
Build succeeded. Unrecognized command or argument '[suggest:6]'
Until I ctrl-c
For my program it just pauses a brief second and then appends .\ to the command line and prints out the files like:
The above was with Windows Terminal and I had loaded my profile.ps1 which does change some PSReadLine settings. I also tried this in ConEmu.
I tried with vanilla Windows PowerShell.exe and no profile - same action for my program, except the files don't print out (because PSReadLine isn't configured to do so). For dotnet-ef it was as if it was not doing anything, just cycled through the files in the directory (in directory no1)
It looks like dotnet-suggest will have a registration for any dotnet- prefixed tool but they'll only work if they're using System.CommandLine. I see a number of other registrations when I run dotnet-suggest list that I know won't work.
But dotnet-suggest is dotnet-suggest enabled. Does dotnet-suggest <TAB> show you completions?
Same behavior under WSL2, Ubuntu 18.04.2 LTS, including with the suggestion to run mycli [suggest]. I can also assert that the bash_profileis running, as I tried adding it without remembering to install .NET and got errors. (Which then disappeared after relaunching the terminal)
@Keboo tells me this should be my first PR, but I'm not entirely sure how to get started, particularly with getting suggestions to point at the local checkout rather than the installed tool. Between CONTRIBUTING.md and documentation, I can probably figure it out, but wouldn't mind tips if you have them.
Most recent dotnet-suggest and System.CommandLine seem to have fixed this for me at least. I can't say exactly which version fixed it as I had been away from my project for a while.
Curious if upgrading has fixed others' issues? If so, we can close this I think.
Activity
jonsequitur commentedon Feb 21, 2020
What shell/terminal are you using?
jonsequitur commentedon Feb 21, 2020
Also, I don't believe
dotnet-efusesSystem.CommandLineso completions withdotnet-suggestwill not be available.erichiller commentedon Feb 22, 2020
If I run
dotnet-suggest listI get this output:So I assumed
dotnet-efwas a valid command to try fordotnet-suggestDirectory no.1 (has no
.csprojfile in it) = trydotnet-ef.exe <TAB>adds to the same line as I typeddotnet-ef.exe <TAB>:No project was found. Change the current working directory or use the --project No project was found. Change the current working directory or use the --project option.Directory no.2 (does have a
.csproj) with no appended.exe=Directory no.2 with
.exeappended:It slows down a ton and then repeated prints:
Until I ctrl-c
For my program it just pauses a brief second and then appends
.\to the command line and prints out the files like:The above was with Windows Terminal and I had loaded my
profile.ps1which does change some PSReadLine settings. I also tried this in ConEmu.I tried with vanilla Windows
PowerShell.exeand no profile - same action for my program, except the files don't print out (because PSReadLine isn't configured to do so). Fordotnet-efit was as if it was not doing anything, just cycled through the files in the directory (in directory no1)jonsequitur commentedon Feb 22, 2020
It looks like
dotnet-suggestwill have a registration for anydotnet-prefixed tool but they'll only work if they're usingSystem.CommandLine. I see a number of other registrations when I rundotnet-suggest listthat I know won't work.But
dotnet-suggestisdotnet-suggestenabled. Doesdotnet-suggest <TAB>show you completions?erichiller commentedon Feb 22, 2020
No, same behavior, it will just cycle through files.
adamhewitt627 commentedon Mar 6, 2020
I'm seeing this as well:
mycli.exe [TAB]yields no suggestions beyond the files in the current directory. Same story even with this example.dotnet-suggestlaunch there, but it doesn't suggest any results.Project
Build
Terminal
Same behavior in VS Code terminal, Windows Terminal, and Windows PowerShell.
dotnet-suggest
jonsequitur commentedon Mar 8, 2020
Can you try running the following and afterward rechecking whether tab completion returns results?
> mycli.exe [suggest]adamhewitt627 commentedon Mar 9, 2020
It took 10-15s to complete, and did output this. However, tab completion is still not working.
adamhewitt627 commentedon Mar 9, 2020
Same behavior under WSL2,
Ubuntu 18.04.2 LTS, including with the suggestion to runmycli [suggest]. I can also assert that thebash_profileis running, as I tried adding it without remembering to install .NET and got errors. (Which then disappeared after relaunching the terminal)@Keboo tells me this should be my first PR, but I'm not entirely sure how to get started, particularly with getting suggestions to point at the local checkout rather than the installed tool. Between CONTRIBUTING.md and documentation, I can probably figure it out, but wouldn't mind tips if you have them.
jonsequitur commentedon Mar 18, 2020
I'd be happy to help you investigate and prepare a PR. It would be very helpful as I don't have an Ubuntu machine set up.
The first thing to do is install a local build of
dotnet-suggest, by runningC:\dev\command-line-api\src\System.CommandLine.Suggest\build-and-install.ps1or equivalent. We don't have ashversion but the script is quite simple. The debug build will write a log file if theDOTNET_SUGGEST_LOGGINGenvironment variable is set. You can see how it works here: https://github.com/dotnet/command-line-api/blob/master/src/System.CommandLine.Suggest/Program.csThe overall call flow looks like this:
> mycli.exe sou<tab>--> shell script ->dotnet-suggest get -e /path/to/mycli --position 3 -- sou-->mycli.exe [suggest:3] souYou'll see something like this in the log file:
At this point you should be able to tell where things are breaking down.
erichiller commentedon Aug 4, 2020
Most recent
dotnet-suggestandSystem.CommandLineseem to have fixed this for me at least. I can't say exactly which version fixed it as I had been away from my project for a while.Curious if upgrading has fixed others' issues? If so, we can close this I think.