-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Help text generation throws InvalidOperationException on Mono #203
Comments
Can you share code that reproduces this problem? I developed the Pager api on macos so I'm not sure what's wrong. |
I will prepare a code snippet. Probably tomorrow morning. BTW you refer to pager, as i understand a new feature. My code is more than 6 months old. I’ m not aware I use this. |
It's new code in the library, not your code, that likely has a bug. I'm just trying to figure out if you're doing anything special to trigger this. It doesn't reproduce for me. What is supposed to happen is that running |
Below a snippet of the code using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Net;
using System.Threading.Tasks;
using McMaster.Extensions.CommandLineUtils;
using McMaster.Extensions.CommandLineUtils.Validation;
using McMaster.Extensions.CommandLineUtils.Abstractions;
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using Clientele.Application.Common;
using Clientele.Proxies.SupportCall.SupportCallWS;
using System.Security.Cryptography;
using System.Text;
using System.IO;
namespace CLI
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
// [STAThread]
static int Main(string[] args)
{
ArgumentEscaper.EscapeAndConcatenate(args);
var app = new CommandLineApplication();
app.HelpOption("-?|-h|--help");
app.FullName = "CLI";
app.Name = "CLI";
app.Description = "Clientele CLI to create supportcalls";
app.VersionOptionFromAssemblyAttributes(typeof(Program).Assembly);
// app.VersionOption("--version", "1.0.0");
var optionSummary = app.Option("-s|--summary <SUMMARY>", "The summary", CommandOptionType
.SingleValue)
.IsRequired();
var optionNotes = app.Option("-n|--notes <NOTES>", "Notes", CommandOptionType
.SingleValue);
var optionCallType = app.Option("-t|--type <TYPE>", "Support call type I , R, S or P", CommandOptionType
.SingleValue)
.IsRequired()
.Accepts(v => v.Values("I", "R", "S", "P"));
app.OnExecute(() =>
{
var summary = "";
summary = optionSummary.Value();
var notes = optionNotes.HasValue()
? optionNotes.Value()
: "";
var type = "";
return 0;
});
return app.Execute(args);
}
}
} |
dotnet --info Runtime Environment: Host (useful for support): .NET Core SDKs installed: .NET Core runtimes installed: |
And now I'm puzzled When I run my app as follows
it runs ok. I'm not really into .NET but when I follow your suggestion to run as
the following happens
|
How are you invoking your app? Which terminal application or IDE? VS for Mac? Rider? Also, can you share the ClienteleCLI.csproj file? I'm confused about whether you are trying to use .NET Core or Mono. |
I was able to reproduce the problem on Mono. Give this updated version of the package a try: https://www.myget.org/feed/natemcmaster/package/nuget/McMaster.Extensions.CommandLineUtils/2.3.1-build.475 |
I can not update from the VS IDE because this update is not available yet, Is this the proper way to install this update ?
|
How are you invoking your app? Which terminal application or IDE? |
|
Hey Nate, I'm having the |
@Jay-Jay-D can you open a new issue and describe steps to reproduce the problem? |
Describe the bug
upgrade from 2.2.5 -> 2.3 breaks application
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Upwards compatibility
Screenshots
Unhandled Exception:
System.InvalidOperationException: The Process object must have the UseShellExecute property set to false in order to redirect IO streams.
at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo) [0x00060] in <23340a11bb41423aa895298bf881ed68>:0
at System.Diagnostics.Process.Start () [0x00032] in <23340a11bb41423aa895298bf881ed68>:0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
at McMaster.Extensions.CommandLineUtils.Pager.CreateWriter () [0x00064] in <5f42c33014224597b1fabe346c86217b>:0
at System.Lazy
1[T].CreateValue () [0x00081] in <98fac219bd4e453693d76fda7bd96ab0>:0 at System.Lazy
1[T].LazyInitValue () [0x00080] in <98fac219bd4e453693d76fda7bd96ab0>:0at System.Lazy
1[T].get_Value () [0x0003a] in <98fac219bd4e453693d76fda7bd96ab0>:0 at McMaster.Extensions.CommandLineUtils.Pager.get_Writer () [0x00013] in <5f42c33014224597b1fabe346c86217b>:0 at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ShowHelp (System.Boolean usePager) [0x00041] in <5f42c33014224597b1fabe346c86217b>:0 at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ShowHelp () [0x00000] in <5f42c33014224597b1fabe346c86217b>:0 at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessOption () [0x00246] in <5f42c33014224597b1fabe346c86217b>:0 at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessNext () [0x00033] in <5f42c33014224597b1fabe346c86217b>:0 at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.Process () [0x00015] in <5f42c33014224597b1fabe346c86217b>:0 at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Parse (System.String[] args) [0x00014] in <5f42c33014224597b1fabe346c86217b>:0 at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00000] in <5f42c33014224597b1fabe346c86217b>:0 at ClienteleCLI.Program.Main (System.String[] args) [0x00130] in <27420bcba69640678847b326b3cb6ebd>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: The Process object must have the UseShellExecute property set to false in order to redirect IO streams. at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo) [0x00060] in <23340a11bb41423aa895298bf881ed68>:0 at System.Diagnostics.Process.Start () [0x00032] in <23340a11bb41423aa895298bf881ed68>:0 at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start() at McMaster.Extensions.CommandLineUtils.Pager.CreateWriter () [0x00064] in <5f42c33014224597b1fabe346c86217b>:0 at System.Lazy
1[T].CreateValue () [0x00081] in <98fac219bd4e453693d76fda7bd96ab0>:0at System.Lazy
1[T].LazyInitValue () [0x00080] in <98fac219bd4e453693d76fda7bd96ab0>:0 at System.Lazy
1[T].get_Value () [0x0003a] in <98fac219bd4e453693d76fda7bd96ab0>:0at McMaster.Extensions.CommandLineUtils.Pager.get_Writer () [0x00013] in <5f42c33014224597b1fabe346c86217b>:0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ShowHelp (System.Boolean usePager) [0x00041] in <5f42c33014224597b1fabe346c86217b>:0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ShowHelp () [0x00000] in <5f42c33014224597b1fabe346c86217b>:0
at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessOption () [0x00246] in <5f42c33014224597b1fabe346c86217b>:0
at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessNext () [0x00033] in <5f42c33014224597b1fabe346c86217b>:0
at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.Process () [0x00015] in <5f42c33014224597b1fabe346c86217b>:0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Parse (System.String[] args) [0x00014] in <5f42c33014224597b1fabe346c86217b>:0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00000] in <5f42c33014224597b1fabe346c86217b>:0
at ClienteleCLI.Program.Main (System.String[] args) [0x00130] in <27420bcba69640678847b326b3cb6ebd>:0
Additional context
Macos
The text was updated successfully, but these errors were encountered: