@@ -106,7 +106,7 @@ public async Task RunAsync()
106106 if ( commandDescriptor . CommandType == CommandType . DefaultCommand && args . Length == 0 )
107107 {
108108 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 ) ) )
110110 {
111111 options . CommandDescriptors . TryGetHelpMethod ( out commandDescriptor ) ;
112112 }
@@ -294,7 +294,7 @@ bool TryGetInvokeArguments(ParameterInfo[] parameters, string?[] args, int argsO
294294 {
295295 if ( optionByIndex . Count <= option . Index )
296296 {
297- if ( ! item . HasDefaultValue ( ) )
297+ if ( ! item . HasDefaultValue )
298298 {
299299 throw new InvalidOperationException ( $ "Required argument { option . Index } was not found in specified arguments.") ;
300300 }
@@ -346,20 +346,13 @@ bool TryGetInvokeArguments(ParameterInfo[] parameters, string?[] args, int argsO
346346 var elemType = UnwrapCollectionElementType ( parameters [ i ] . ParameterType ) ;
347347 if ( elemType == typeof ( string ) )
348348 {
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 + "\" " ) ) + "]" ;
352352 }
353353 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 + "]" ;
363356 }
364357 }
365358 else
@@ -408,9 +401,9 @@ bool TryGetInvokeArguments(ParameterInfo[] parameters, string?[] args, int argsO
408401 }
409402 }
410403
411- if ( item . HasDefaultValue ( ) )
404+ if ( item . HasDefaultValue )
412405 {
413- invokeArgs [ i ] = item . DefaultValue ( ) ;
406+ invokeArgs [ i ] = item . DefaultValue ;
414407 }
415408 else if ( item . ParameterType == typeof ( bool ) )
416409 {
0 commit comments