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
In ValidateArgScaffold method, ArgRevivers.CanRevive is called with the type of the property. But ArgRevivers.CanRevive loads custom revivers by searching the assembly of the type passed in. So if the type and custom reviver are not defined in the same assembly, the custom reviver cannot be found.
I encountered the problem when using System.Net.Mail.MailAddress as argument type. The code is pasted here to help you debug the issue: (in F#)
type MailAddressReviver()=
[<ArgReviver>]
static member Revive (key:string) (address:string) =
new System.Net.Mail.MailAddress(address)
[<TabCompletion>]
type MyArgs()=
[<ArgDescription("Show this help information")>]
[<ArgShortcut("h")>]
member val Help = false with get, set
[<ArgDescription("Mail to")>]
[<ArgShortcut("mt")>]
member val MailTo:System.Net.Mail.MailAddress = null with get, set
The text was updated successfully, but these errors were encountered:
I'll be adding Args.SearchAssemblyForRevivers(myAssembly) to an upcoming release to solve this issue properly. It's already checked in, but not published to NuGet. I'll leave the issue open until then.
As a workaround for now you can Make a dummy call to any Args method that does a Parse and requires a reviver for a type that IS DEFINED in your assembly. That will trigger PowerArgs to search your entire assembly and will find the MailAddress reviver.
The cause is:
In
ValidateArgScaffold
method,ArgRevivers.CanRevive
is called with the type of the property. ButArgRevivers.CanRevive
loads custom revivers by searching the assembly of the type passed in. So if the type and custom reviver are not defined in the same assembly, the custom reviver cannot be found.I encountered the problem when using System.Net.Mail.MailAddress as argument type. The code is pasted here to help you debug the issue: (in F#)
The text was updated successfully, but these errors were encountered: