<PackageReference Include="Castle.Core" Version="3.2.1" />

RemotableInvocation

using System; using System.Reflection; using System.Runtime.Serialization; namespace Castle.DynamicProxy.Serialization { [Serializable] public class RemotableInvocation : MarshalByRefObject, IInvocation, ISerializable { private readonly IInvocation parent; public Type[] GenericArguments => parent.GenericArguments; public object Proxy => parent.Proxy; public object InvocationTarget => parent.InvocationTarget; public Type TargetType => parent.TargetType; public object[] Arguments => parent.Arguments; public MethodInfo Method => parent.Method; public MethodInfo MethodInvocationTarget => parent.MethodInvocationTarget; public object ReturnValue { get { return parent.ReturnValue; } set { parent.ReturnValue = value; } } public RemotableInvocation(IInvocation parent) { this.parent = parent; } protected RemotableInvocation(SerializationInfo info, StreamingContext context) { parent = (IInvocation)info.GetValue("invocation", typeof(IInvocation)); } public void SetArgumentValue(int index, object value) { parent.SetArgumentValue(index, value); } public object GetArgumentValue(int index) { return parent.GetArgumentValue(index); } public void Proceed() { parent.Proceed(); } public MethodInfo GetConcreteMethod() { return parent.GetConcreteMethod(); } public MethodInfo GetConcreteMethodInvocationTarget() { return parent.GetConcreteMethodInvocationTarget(); } public void GetObjectData(SerializationInfo info, StreamingContext context) { info.SetType(typeof(RemotableInvocation)); info.AddValue("invocation", new RemotableInvocation(this)); } } }