Antaris.AspNetCore.Mvc.Widgets.Infrastructure.DefaultWidgetInvoker.InvokeSyncCore C# (CSharp) Méthode

InvokeSyncCore() private méthode

Invokes a synchronous method.
private InvokeSyncCore ( MethodInfo method, WidgetContext context ) : IWidgetResult
method System.Reflection.MethodInfo The method to invoke.
context WidgetContext The widget context.
Résultat IWidgetResult
        private IWidgetResult InvokeSyncCore(MethodInfo method, WidgetContext context)
        {
            var widget = CreateWidget(context);
            object result = null;

            var arguments = GetArgumentsAsync(context, method, context.Values).GetAwaiter().GetResult();

            try
            {
                result = method.Invoke(widget, arguments);
                var widgetResult = CoerceToWidgetResult(result);

                return widgetResult;
            }
            catch (TargetInvocationException ex)
            {
                var exceptionInfo = ExceptionDispatchInfo.Capture(ex.InnerException);
                exceptionInfo.Throw();

                return null; // Unreachable
            }
        }