Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registration with dotnet-suggest requires UseShellExecute to be False on NetFx472 #1254

Closed
smaine opened this issue Apr 14, 2021 · 4 comments

Comments

@smaine
Copy link

smaine commented Apr 14, 2021

Does dotnet-suggest support suggestions from applications built against the desktop framework?

I was spelunking why dotnet-suggest list wasn't showing my application as being registered, which lead me to the sentinel file in [IO.Path]::GetTempPath()\system-commandline-sentinel-files, where this exception was logged:

Exception during registration:
System.InvalidOperationException: The Process object must have the UseShellExecute property set to false in order to redirect IO streams.
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at System.CommandLine.Invocation.Process.StartProcess(String command, String args, String workingDir, Action`1 stdOut, Action`1 stdErr, ValueTuple`2[] environmentVariables)
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_1>d.MoveNext()

This feels like it's probably framework/OS dependent, which is why I'm hesitant to just submit a patch to https://github.com/dotnet/command-line-api/blob/main/src/System.CommandLine/Builder/CommandLineBuilderExtensions.cs

@elgonzo
Copy link
Contributor

elgonzo commented Apr 15, 2021

No need to submit a patch, as the respective code change (UseShellExecute = false) has been made in January :-)

var process = new Diagnostics.Process
{
StartInfo =
{
Arguments = args,
FileName = command,
RedirectStandardError = true,
RedirectStandardOutput = true,
RedirectStandardInput = true,
UseShellExecute = false
}
};

@smaine
Copy link
Author

smaine commented Apr 15, 2021

Awesome. Is that after the https://www.nuget.org/packages/System.CommandLine/2.0.0-beta1.20574.7, which is the most recently published version available on NuGet.org?

@jonsequitur
Copy link
Contributor

It is. The fix is available on the "daily" build feed and a new version will be published on nuget.org in the next day or two.

@smaine smaine closed this as completed Apr 16, 2021
@smaine
Copy link
Author

smaine commented Apr 20, 2021

Updated to 21216.1 and it works as expected. Thanks for pushing the updated package!

mjcheetham added a commit to mjcheetham/git-credential-manager that referenced this issue Nov 15, 2021
Update the System.CommandLine package to 2.0.0-beta1.21216.1 to
hopefully fix some problems with dotnet-suggest registration caused by
Process::UseShellExecute differences between .NET Framework and .NET
(Core).

jonsequitur/command-line-api@ad22b69
dotnet/command-line-api#1254
git-ecosystem#505
mminns pushed a commit to mminns/Git-Credential-Manager that referenced this issue Nov 22, 2021
Update the System.CommandLine package to 2.0.0-beta1.21216.1 to
hopefully fix some problems with dotnet-suggest registration caused by
Process::UseShellExecute differences between .NET Framework and .NET
(Core).

jonsequitur/command-line-api@ad22b69
dotnet/command-line-api#1254
git-ecosystem#505
ldennington pushed a commit to ldennington/git-credential-manager that referenced this issue Jun 15, 2022
Update the System.CommandLine package to 2.0.0-beta1.21216.1 to
hopefully fix some problems with dotnet-suggest registration caused by
Process::UseShellExecute differences between .NET Framework and .NET
(Core).

jonsequitur/command-line-api@ad22b69
dotnet/command-line-api#1254
git-ecosystem#505
caixtong pushed a commit to caixtong/credent-manager that referenced this issue Jun 19, 2022
Update the System.CommandLine package to 2.0.0-beta1.21216.1 to
hopefully fix some problems with dotnet-suggest registration caused by
Process::UseShellExecute differences between .NET Framework and .NET
(Core).

jonsequitur/command-line-api@ad22b69
dotnet/command-line-api#1254
git-ecosystem/git-credential-manager#505
imgbot bot pushed a commit to Jeverett3000/Git-Credential-Manager-Core that referenced this issue Nov 2, 2022
Update the System.CommandLine package to 2.0.0-beta1.21216.1 to
hopefully fix some problems with dotnet-suggest registration caused by
Process::UseShellExecute differences between .NET Framework and .NET
(Core).

jonsequitur/command-line-api@ad22b69
dotnet/command-line-api#1254
git-ecosystem#505
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants