protobuf-net / protobuf-net.Grpc

GRPC bindings for protobuf-net and grpc-dotnet
Other
846 stars 106 forks source link

Service Method Input Parameter of Type int Throws Exception #313

Open AYColumbia opened 8 months ago

AYColumbia commented 8 months ago

I added a new service with a method that takes an int input parameter and the call kept failing with the exception below.

Error obtaining client-helper 'UnaryTaskAsync' (from: 'System.Int32', to: 'System.Collections.Generic.IEnumerable´1[[Project.DataLayer.Application.Models.WebARMenu, Project.DataLayer.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'): GenericArguments[0], 'System.Int32', on 'System.Threading.Tasks.Task´1[TResponse] UnaryTaskAsync[TRequest,TResponse](ProtoBuf.Grpc.CallContext ByRef, Grpc.Core.CallInvoker, Grpc.Core.Method´2[TRequest,TResponse], TRequest, System.String)' violates the constraint of type 'TRequest'.

I was able to get around it by creating a data contract with the int parameter as a property and update my service method to take the data contract object as the input.

I have seen some stackoverflow posts on this now that go back to 2020 and mention adding support for int input param types. It's now 2023 and am wondering if this is going to happen any time soon? Thanks.