@@ -106,7 +106,7 @@ public async Task RunAsync()
106
106
if ( commandDescriptor . CommandType == CommandType . DefaultCommand && args . Length == 0 )
107
107
{
108
108
var p = commandDescriptor . MethodInfo . GetParameters ( ) ;
109
- if ( p . Any ( x => ! ( x . ParameterType == typeof ( ConsoleAppContext ) || isService . IsService ( x . ParameterType ) || x . HasDefaultValue ( ) ) ) )
109
+ if ( p . Any ( x => ! ( x . ParameterType == typeof ( ConsoleAppContext ) || isService . IsService ( x . ParameterType ) || x . HasDefaultValue ) ) )
110
110
{
111
111
options . CommandDescriptors . TryGetHelpMethod ( out commandDescriptor ) ;
112
112
}
@@ -294,7 +294,7 @@ bool TryGetInvokeArguments(ParameterInfo[] parameters, string?[] args, int argsO
294
294
{
295
295
if ( optionByIndex . Count <= option . Index )
296
296
{
297
- if ( ! item . HasDefaultValue ( ) )
297
+ if ( ! item . HasDefaultValue )
298
298
{
299
299
throw new InvalidOperationException ( $ "Required argument { option . Index } was not found in specified arguments.") ;
300
300
}
@@ -346,20 +346,13 @@ bool TryGetInvokeArguments(ParameterInfo[] parameters, string?[] args, int argsO
346
346
var elemType = UnwrapCollectionElementType ( parameters [ i ] . ParameterType ) ;
347
347
if ( elemType == typeof ( string ) )
348
348
{
349
- if ( parameters . Length == i + 1 )
350
- {
351
- v = "[" + string . Join ( "," , optionByIndex . Skip ( parameters [ i ] . Position ) . Select ( x => "\" " + x . Value + "\" " ) ) + "]" ;
349
+ if ( ! ( v . StartsWith ( " \" " ) && v . EndsWith ( " \" " ) ) )
350
+ {
351
+ v = "[" + string . Join ( "," , v . Split ( ' ' , ',' ) . Select ( x => "\" " + x + "\" " ) ) + "]" ;
352
352
}
353
353
else
354
- {
355
- if ( ! ( v . StartsWith ( "\" " ) && v . EndsWith ( "\" " ) ) )
356
- {
357
- v = "[" + string . Join ( "," , v . Split ( ' ' , ',' ) . Select ( x => "\" " + x + "\" " ) ) + "]" ;
358
- }
359
- else
360
- {
361
- v = "[" + v + "]" ;
362
- }
354
+ {
355
+ v = "[" + v + "]" ;
363
356
}
364
357
}
365
358
else
@@ -408,9 +401,9 @@ bool TryGetInvokeArguments(ParameterInfo[] parameters, string?[] args, int argsO
408
401
}
409
402
}
410
403
411
- if ( item . HasDefaultValue ( ) )
404
+ if ( item . HasDefaultValue )
412
405
{
413
- invokeArgs [ i ] = item . DefaultValue ( ) ;
406
+ invokeArgs [ i ] = item . DefaultValue ;
414
407
}
415
408
else if ( item . ParameterType == typeof ( bool ) )
416
409
{
0 commit comments