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
When upgrading from V3.0 to V3.1, we experience test failures around the -h | --help flag. Namely, in our testing environment, running the help command is throwing an exception inside the McMaster Utility.
As part of our creation workflow, we have a custom implementation of IValidator called 'ExistingDirectoryOrTarFileValidator'.
private class ExistingDirectoryOrTarFileValidator : IValidator {[removed for brevity]}
It is added to an IValidationBuilder with the .Use(IValidator) method.
This builder is used when creating a command option.
var inputOption = app.Option<string>( "-i|--input", "A directory, or a *.tar archive, containing all source files to be compiled.", CommandOptionType.MultipleValue) .IsRequired() .Accepts(p => p.ExistingFileOrDirectory() .IfExistingFileThenHasTarExtension());
Exception:
Unable to cast object of type 'ExistingDirectoryOrTarFileValidator' to type 'McMaster.Extensions.CommandLineUtils.Validation.AttributeValidator'.
Stack Trace:
at System.Linq.Enumerable.<CastIterator>d__63``1.MoveNext() in /_/src/System.Linq/src/System/Linq/Cast.cs:line 52 at McMaster.Extensions.CommandLineUtils.HelpText.DefaultHelpTextGenerator.GenerateOptions(CommandLineApplication application, TextWriter output, IReadOnlyList``1 visibleOptions, Int32 firstColumnWidth) at McMaster.Extensions.CommandLineUtils.HelpText.DefaultHelpTextGenerator.GenerateBody(CommandLineApplication application, TextWriter output) at McMaster.Extensions.CommandLineUtils.HelpText.DefaultHelpTextGenerator.Generate(CommandLineApplication application, TextWriter output) at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessOption(OptionArgument arg) at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessNext() at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.Process() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Parse(String[] args) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<ExecuteAsync>d__157.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151 at System.Runtime.CompilerServices.TaskAwaiter``1.GetResult() in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 369 at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at [Removed for privacy].Program.Main(String[] args) in D:\repos\[removed for privacy]\Program.cs:line 255
When upgrading from V3.0 to V3.1, we experience test failures around the -h | --help flag. Namely, in our testing environment, running the help command is throwing an exception inside the McMaster Utility.
As part of our creation workflow, we have a custom implementation of IValidator called 'ExistingDirectoryOrTarFileValidator'.
private class ExistingDirectoryOrTarFileValidator : IValidator {[removed for brevity]}
It is added to an IValidationBuilder with the .Use(IValidator) method.
public static IValidationBuilder IfExistingFileThenHasTarExtension(this IValidationBuilder builder) { builder.Use(new ExistingDirectoryOrTarFileValidator()); return builder; }
This builder is used when creating a command option.
var inputOption = app.Option<string>( "-i|--input", "A directory, or a *.tar archive, containing all source files to be compiled.", CommandOptionType.MultipleValue) .IsRequired() .Accepts(p => p.ExistingFileOrDirectory() .IfExistingFileThenHasTarExtension());
Exception:
Unable to cast object of type 'ExistingDirectoryOrTarFileValidator' to type 'McMaster.Extensions.CommandLineUtils.Validation.AttributeValidator'.
Stack Trace:
at System.Linq.Enumerable.<CastIterator>d__63``1.MoveNext() in /_/src/System.Linq/src/System/Linq/Cast.cs:line 52 at McMaster.Extensions.CommandLineUtils.HelpText.DefaultHelpTextGenerator.GenerateOptions(CommandLineApplication application, TextWriter output, IReadOnlyList``1 visibleOptions, Int32 firstColumnWidth) at McMaster.Extensions.CommandLineUtils.HelpText.DefaultHelpTextGenerator.GenerateBody(CommandLineApplication application, TextWriter output) at McMaster.Extensions.CommandLineUtils.HelpText.DefaultHelpTextGenerator.Generate(CommandLineApplication application, TextWriter output) at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessOption(OptionArgument arg) at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.ProcessNext() at McMaster.Extensions.CommandLineUtils.CommandLineProcessor.Process() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Parse(String[] args) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<ExecuteAsync>d__157.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /_/src/System.Private.CoreLib/shared/System/Runtime/ExceptionServices/ExceptionDispatchInfo.cs:line 63 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 180 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 151 at System.Runtime.CompilerServices.TaskAwaiter``1.GetResult() in /_/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TaskAwaiter.cs:line 369 at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at [Removed for privacy].Program.Main(String[] args) in D:\repos\[removed for privacy]\Program.cs:line 255
This bug appears to have been introduced in #369.
The text was updated successfully, but these errors were encountered: