FSharp.GrpcCodeGenerator
FSharp.GrpcCodeGenerator copied to clipboard
Generated code does not work with JsonTranscoding
Get the following error when starting the app with JSON Transcoding enabled in .net 7:
warn: Microsoft.AspNetCore.Grpc.JsonTranscoding.Internal.Binding.JsonTranscodingServiceMethodProvider[2]
Error getting service descriptor for BarServer.BarServerService.
System.InvalidOperationException: Get not find Descriptor property on FooServiceMethodBinder.
at Grpc.Shared.ServiceDescriptorHelpers.GetServiceDescriptor(Type serviceReflectionType)
at Microsoft.AspNetCore.Grpc.JsonTranscoding.Internal.Binding.JsonTranscodingServiceMethodProvider`1.OnServiceMethodDiscovery(ServiceMethodProviderContext`1 context)
This seems like it's related to some missing generated Descriptor properties.
After manually adding a descriptor property on the type requested, I get the following error hitting the generated REST endpoint:
{
"code": 3,
"message": "Cannot dynamically create an instance of type 'Proto.FooRequest'. Reason: No parameterless constructor defined.",
"details": []
}
Maybe this just won't work with F# records as the protobuf messages.