protected override object? Invoke()

in src/Testing/Emulator/SectionContextProxy.cs [27:47]


    protected override object? Invoke(MethodInfo? targetMethod, object?[]? args)
    {
        ArgumentNullException.ThrowIfNull(targetMethod);
        ArgumentNullException.ThrowIfNull(targetMethod.DeclaringType);

        if (!_handlers.TryGetValue(targetMethod.Name, out var handler))
        {
            throw new NotImplementedException(targetMethod.Name);
        }

        try
        {
            return handler.Handle(_context, args);
        }
        catch (FinishSectionProcessingException) { throw; }
        catch (PolicyException) { throw; }
        catch (Exception e)
        {
            throw new PolicyException(e) { Policy = targetMethod.Name, Section = _sectionName, PolicyArgs = args };
        }
    }