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
Nulling a property of CommandLineArgumentsConfiguration between assigning it to CommandLineArguments.Configuration and calling CommandLineArguments.TryParse() or .DisplayHelp() results in NullReferenceExceptions
#62
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.
It's possible to create a CommandLineArgumentsConfiguration object, assign it to CommandLineArguments.Configuration and then null the Parser and/or HelpWriter property of the configuration. This results in NullRefefenceExceptions when calling CommandLineArguments.TryParse() or CommandLineArguments.DisplayHelp() because the configuration is only validated when assiging it to CommandLineArguments.Configuration.
Example
varconfig=newCommandLineArgumentsConfiguration(){Parser=newWindowsStyleParser(),HelpWriter=newWindowsStyleHelpWriter()};CommandLineArguments.Configuration=config;// Configuration is validated hereconfig.Parser=null;CommandLineArguments.TryParse(args,outvarparsedArguments);;// NullReferenceException
The text was updated successfully, but these errors were encountered:
It's possible to create a
CommandLineArgumentsConfiguration
object, assign it toCommandLineArguments.Configuration
and then null theParser
and/orHelpWriter
property of the configuration. This results in NullRefefenceExceptions when callingCommandLineArguments.TryParse()
orCommandLineArguments.DisplayHelp()
because the configuration is only validated when assiging it toCommandLineArguments.Configuration
.Example
The text was updated successfully, but these errors were encountered: