From 5a1608d0f89a4988afa417092d831617e5d176e9 Mon Sep 17 00:00:00 2001 From: Jean-Jacques Lafay Date: Thu, 14 Oct 2021 15:10:56 +0200 Subject: [PATCH] Remove remnant of old code No longer any reason to handle delegates specifically : it will be done naturally by the marshallerCache (and who knows, maybe it *can* serialize some delegates !). Moreover, this could misinterpret a signature as valid without parameter, with somewhat weird consequences. --- src/protobuf-net.Grpc/Internal/ContractOperation.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/protobuf-net.Grpc/Internal/ContractOperation.cs b/src/protobuf-net.Grpc/Internal/ContractOperation.cs index d2a337eb..b79f70d4 100644 --- a/src/protobuf-net.Grpc/Internal/ContractOperation.cs +++ b/src/protobuf-net.Grpc/Internal/ContractOperation.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Reflection; using Grpc.Core; @@ -179,8 +179,6 @@ static TypeCategory GetCategory(MarshallerCache marshallerCache, Type type, IBin if (genType == typeof(AsyncServerStreamingCall<>)) return TypeCategory.AsyncServerStreamingCall; } - if (typeof(Delegate).IsAssignableFrom(type)) return TypeCategory.None; // yeah, that's not going to happen - if (marshallerCache.CanSerializeType(type)) return TypeCategory.Data; bindContext?.LogWarning("Type cannot be serialized; ignoring: {0}", type.FullName); return TypeCategory.Invalid; @@ -205,7 +203,7 @@ internal static bool TryIdentifySignature(MethodInfo method, BinderConfiguration if (method.IsGenericMethodDefinition) return false; // can't work with methods if ((method.Attributes & (MethodAttributes.SpecialName)) != 0) return false; // some kind of accessor etc - + if (!binderConfig.Binder.IsOperationContract(method, out var opName)) return false; var args = method.GetParameters();