cyanfish / grpc-dotnet-namedpipes

Named pipe transport for gRPC in C#/.NET
Apache License 2.0
183 stars 47 forks source link

Fix RpcException trailers not propagating to client #53

Closed MartinHoma closed 6 months ago

MartinHoma commented 9 months ago

I've encountered the same problem as @alexhelms - RpcException trailers are not accessible on the client side. For me this is a major blocker and given that the Alex's pull request has not been merged yet and doesn't seem to be proceeding at all due to CLA issues I've decided to create another pull request based on Alex's code (I hope Alex doesn't mind).

However, Alex's code doesn't solve the whole issue for me. Custom trailers are sent to client only if they are put to the ResponseTrailers on the server call context. If there is a custom RpcException thrown on the server side, the trailers stored in the exception are not transferred to the client. I've decided to take the same approach as ASP .NET Core does - adding trailers from the caught RpcException to the server call context before sending it to the client - please see the void ProcessHandlerError(Exception ex, string method) method in HttpContextServerCallContext. The logic works for both unary and streaming calls.

alexhelms commented 9 months ago

Hi @MartinHoma, thanks for the mention. In the background I've been trying to figure out who in my org can sign the CLA but that is proving difficult...I have no problem if @cyanfish wants to close #45 and merge this instead.

cyanfish commented 6 months ago

This didn't resolve the CLA issues as copyright is held by the original code author, but I've fixed this in e485a5d4bede688d3e490c466a1f5d6e6925b4c5.