File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/System.CommandLine/Invocation Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -65,8 +65,14 @@ public async Task<int> InvokeAsync(InvocationContext context)
65
65
object result ;
66
66
if ( _handlerDelegate is null )
67
67
{
68
- var invocationTarget = _invocationTarget ??
69
- _invocationTargetBinder ? . CreateInstance ( bindingContext ) ;
68
+ var invocationTarget = _invocationTarget ??
69
+ bindingContext . ServiceProvider . GetService ( _handlerMethodInfo ! . DeclaringType ) ;
70
+ if ( ! ( invocationTarget is null ) )
71
+ {
72
+ _invocationTargetBinder ? . UpdateInstance ( invocationTarget , bindingContext ) ;
73
+ }
74
+
75
+ invocationTarget ??= _invocationTargetBinder ? . CreateInstance ( bindingContext ) ;
70
76
result = _handlerMethodInfo ! . Invoke ( invocationTarget , invocationArguments ) ;
71
77
}
72
78
else
You can’t perform that action at this time.
0 commit comments