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

bool reviver not working #166

Open
brandonh-msft opened this issue Oct 12, 2023 · 0 comments
Open

bool reviver not working #166

brandonh-msft opened this issue Oct 12, 2023 · 0 comments

Comments

@brandonh-msft
Copy link

I have a property of type bool with the following attributes on it already:

    [ArgIgnoreCase]
    [ArgShortcut(ArgShortcutPolicy.NoShortcut)]
    [ArgRequired(IfNot = nameof(Suffix), PromptIfMissing = true)]
    [ArgDescription("Overwrites source files when modified. Defaults to false if unspecified. This or `-suffix` must be given.")]

However when I am prompted to enter a value (because I left it off the arguments), I enter true and am met with an exception:

System.Reflection.TargetException
  HResult=0x80131603
  Message=Object does not match target type.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Reflection.RuntimeMethodInfo.InvokePropertySetter(Object obj, BindingFlags invokeAttr, Binder binder, Object parameter, CultureInfo culture) in System.Reflection\RuntimeMethodInfo.cs:line 342

  This exception was originally thrown at this call stack:

Here is more stack trace detail:

>	PowerArgs.dll!PowerArgs.ArgRequiredConditionalHook.TryPreventExceptionWithPrompt(PowerArgs.ArgHook.HookContext context) Line 108	C#
 	PowerArgs.dll!PowerArgs.ArgRequiredConditionalHook.Evaluate(PowerArgs.ArgHook.HookContext context, string expressionText, bool not) Line 54	C#
 	PowerArgs.dll!PowerArgs.ArgRequiredConditionalHook.AfterPopulateProperties(PowerArgs.ArgHook.HookContext context) Line 35	C#
 	PowerArgs.dll!PowerArgs.ArgHook.HookContext.RunAfterPopulateProperties.AnonymousMethod__39_1(PowerArgs.ArgHook h) Line 212	C#
 	PowerArgs.dll!PowerArgs.ArgHook.HookContext.RunHook(System.Func<PowerArgs.ArgHook, int> orderby, System.Action<PowerArgs.ArgHook> hookAction) Line 187	C#
 	PowerArgs.dll!PowerArgs.ArgHook.HookContext.RunAfterPopulateProperties() Line 213	C#
 	PowerArgs.dll!PowerArgs.Args.ParseInternal(PowerArgs.CommandLineArgumentsDefinition definition, string[] input) Line 511	C#
 	PowerArgs.dll!PowerArgs.Args.ParseAction.AnonymousMethod__0() Line 170	C#
 	PowerArgs.dll!PowerArgs.Args.Execute<PowerArgs.ArgAction>(System.Func<PowerArgs.ArgAction> argsProcessingCode) Line 363	C#
 	PowerArgs.dll!PowerArgs.Args.ParseAction(PowerArgs.CommandLineArgumentsDefinition definition, string[] args) Line 167	C#

I'm using PA v4.0.3

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

1 participant