@@ -334,19 +334,30 @@ await SendInvocationError(hubMethodInvocationMessage.InvocationId, connection,
334
334
else
335
335
{
336
336
// Invoke or Send
337
- async Task ExecuteInvocation ( )
337
+ static async Task ExecuteInvocation ( DefaultHubDispatcher < THub > dispatcher ,
338
+ ObjectMethodExecutor methodExecutor ,
339
+ THub hub ,
340
+ object ? [ ] arguments ,
341
+ IServiceScope scope ,
342
+ IHubActivator < THub > hubActivator ,
343
+ HubConnectionContext connection ,
344
+ HubMethodInvocationMessage hubMethodInvocationMessage ,
345
+ bool isStreamCall )
338
346
{
347
+ var logger = dispatcher . _logger ;
348
+ var enableDetailedErrors = dispatcher . _enableDetailedErrors ;
349
+
339
350
object ? result ;
340
351
try
341
352
{
342
- result = await ExecuteHubMethod ( methodExecutor , hub , arguments , connection , scope . ServiceProvider ) ;
343
- Log . SendingResult ( _logger , hubMethodInvocationMessage . InvocationId , methodExecutor ) ;
353
+ result = await dispatcher . ExecuteHubMethod ( methodExecutor , hub , arguments , connection , scope . ServiceProvider ) ;
354
+ Log . SendingResult ( logger , hubMethodInvocationMessage . InvocationId , methodExecutor ) ;
344
355
}
345
356
catch ( Exception ex )
346
357
{
347
- Log . FailedInvokingHubMethod ( _logger , hubMethodInvocationMessage . Target , ex ) ;
348
- await SendInvocationError ( hubMethodInvocationMessage . InvocationId , connection ,
349
- ErrorMessageHelper . BuildErrorMessage ( $ "An unexpected error occurred invoking '{ hubMethodInvocationMessage . Target } ' on the server.", ex , _enableDetailedErrors ) ) ;
358
+ Log . FailedInvokingHubMethod ( logger , hubMethodInvocationMessage . Target , ex ) ;
359
+ await dispatcher . SendInvocationError ( hubMethodInvocationMessage . InvocationId , connection ,
360
+ ErrorMessageHelper . BuildErrorMessage ( $ "An unexpected error occurred invoking '{ hubMethodInvocationMessage . Target } ' on the server.", ex , enableDetailedErrors ) ) ;
350
361
return ;
351
362
}
352
363
finally
@@ -355,7 +366,7 @@ await SendInvocationError(hubMethodInvocationMessage.InvocationId, connection,
355
366
// And normal invocations handle cleanup below in the finally
356
367
if ( isStreamCall )
357
368
{
358
- await CleanupInvocation ( connection , hubMethodInvocationMessage , hubActivator , hub , scope ) ;
369
+ await dispatcher . CleanupInvocation ( connection , hubMethodInvocationMessage , hubActivator , hub , scope ) ;
359
370
}
360
371
}
361
372
@@ -366,7 +377,8 @@ await SendInvocationError(hubMethodInvocationMessage.InvocationId, connection,
366
377
await connection . WriteAsync ( CompletionMessage . WithResult ( hubMethodInvocationMessage . InvocationId , result ) ) ;
367
378
}
368
379
}
369
- invocation = ExecuteInvocation ( ) ;
380
+
381
+ invocation = ExecuteInvocation ( this , methodExecutor , hub , arguments , scope , hubActivator , connection , hubMethodInvocationMessage , isStreamCall ) ;
370
382
}
371
383
372
384
if ( isStreamCall || isStreamResponse )
0 commit comments