adamabdelhamed / PowerArgs

The ultimate .NET Standard command line argument parser
MIT License
569 stars 56 forks source link

Null reference exception is thrown when running REPLInvoke sample and immediately quitting #120

Closed hoochharp closed 7 years ago

hoochharp commented 7 years ago

If you run the REPLInvoke sample (or any REPL app) and simply type 'quit' as the very first thing you do, a null reference exception is thrown in Args.cs line 546

  private static ArgAction<T> Strongify<T>(ArgAction weak)
    {
        return new ArgAction<T>()
        {
            Args = (T)weak.Value,
            ActionArgs = weak.ActionArgs,
            ActionArgsProperty = weak.ActionArgsProperty,
            ActionParameters = weak.ActionParameters,
            ActionArgsMethod = weak.ActionArgsMethod,
            HandledException = weak.HandledException,
            Definition = weak.Definition,
            Context = weak.Context,
            Cancelled = weak.Cancelled,
        };
    }

The parameter 'weak' is null but used anyway when creating a new ArgAction.

adamabdelhamed commented 7 years ago

Fixed in version 3.0