diff --git a/src/StreamJsonRpc/JsonRpc.cs b/src/StreamJsonRpc/JsonRpc.cs index ea125ce73..efff188a9 100644 --- a/src/StreamJsonRpc/JsonRpc.cs +++ b/src/StreamJsonRpc/JsonRpc.cs @@ -29,7 +29,7 @@ public class JsonRpc : IDisposableObservable, IJsonRpcFormatterCallbacks, IJsonR /// private const string JoinableTaskTokenHeaderName = "joinableTaskToken"; - private static readonly MethodInfo MarshalWithControlledLifetimeOpenGenericMethodInfo = typeof(JsonRpc).GetMethods(BindingFlags.Static | BindingFlags.NonPublic).Single(m => m.Name == nameof(MarshalWithControlledLifetime) && m.IsGenericMethod); + private static readonly MethodInfo MarshalWithControlledLifetimeOpenGenericMethodInfo = typeof(JsonRpc).GetMethod(nameof(MarshalWithControlledLifetimeOpen), BindingFlags.Static | BindingFlags.NonPublic)!; /// /// A singleton error object that can be returned by in error cases @@ -1190,26 +1190,26 @@ public void Dispose() /// Use for a simpler lifetime model when the object should only be marshaled within the scope of a single RPC call. /// /// - internal static IRpcMarshaledContext MarshalWithControlledLifetime(T marshaledObject, JsonRpcTargetOptions options) + internal static IRpcMarshaledContext MarshalWithControlledLifetimeOpen(T marshaledObject, JsonRpcTargetOptions options) where T : class { return new RpcMarshaledContext(marshaledObject, options); } - /// - /// - /// - /// + /// + /// + /// + /// internal static IRpcMarshaledContext MarshalWithControlledLifetime(Type interfaceType, object marshaledObject, JsonRpcTargetOptions options) { return (IRpcMarshaledContext)MarshalWithControlledLifetimeOpenGenericMethodInfo.MakeGenericMethod(interfaceType).Invoke(null, new object?[] { marshaledObject, options })!; } - /// + /// /// A proxy value that may be used within an RPC argument so the RPC server may call back into the object on the RPC client. /// /// - /// Use for greater control and flexibility around lifetime of the proxy. + /// Use for greater control and flexibility around lifetime of the proxy. /// This is required when the value is returned from an RPC method or when it is used within an RPC argument and must outlive that RPC invocation. /// /// @@ -1217,7 +1217,7 @@ internal static T MarshalLimitedArgument(T marshaledObject) where T : class { // This method is included in the spec, but hasn't been implemented yet and has no callers. - // It is here to match the spec and to help give some clarity around the boundaries of the MarshalWithControlledLifetime method's responsibilities. + // It is here to match the spec and to help give some clarity around the boundaries of the MarshalWithControlledLifetimeOpen method's responsibilities. throw new NotImplementedException(); }