grpc / grpc/grpc-dotnet

Send Empty object as Data of length and not RST_STREAM

Open
#2,569 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
C#
Stars
4.5k
Forks
836
Avg merge
6d 3h
Merged PRs (30d)
7

Description

Hi,
I have a proto file with the following rpc:
rpc MethodToCall(ObjectToReceive) returns (Empty);
where Empty is declared in the proto file as:
message Empty {}.

After using Grpc.Tools to generate the files I have override this method as follows:
public override Task MethodToCall(ObjectToReceive request, ServerCallContext context)
{
return Task.FromResult(new Empty());
}

In wireshark the response looks like this:
![image](https://github.com/user-attachments/assets/1dd93f47-a159-46ca-a472-4540bed3343b)

Problem is that what I need is the response to have an actual Data field of length 0 as follows:
![image](https://github.com/user-attachments/assets/1ccc9482-ad8a-4c84-86d1-e197cf4ce55a)
where the Data is:
![image](https://github.com/user-attachments/assets/5947748e-0277-4c44-b876-d08bd866d7d2)

I am using .Net Framework 4.7.2.
Can I force the library to send the response like this or it will always decide not to send irrelevant data.

Thank you

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the RPC from the proto definition with the shown C# override on .NET Framework 4.7.2, then compare the generated response with the two Wireshark captures. Trace the response serialization path to determine whether an empty Data field can be emitted; done means establishing the supported wire behavior or a concrete way to request the desired frame.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.