I've found that for gRpc calls, the deserialization of dictionaries with nullable value types changes, purely by including/removing the protobuf-net.Grpc.AspNetCore.Reflection package.
Setup:
Data contract:
[DataContract]
public class TestDataContract
{
[DataMember(Order = 1)]
public IDictionary<string, string?> Test { get; set; } = new Dictionary<string, string?>();
}
Service:
[gRpcService]
public class TestGrpcService : ITestGrpc
{
public async Task<TestDataContract> TestAsync(CallContext context = default)
{
return new TestDataContract {
Test = new Dictionary<string, string?>() { { "test1", "blabla" }, { "test", null } }
};
}
}
Client:
...
var response = await testGrpcClient.Test();
...
I've found that for gRpc calls, the deserialization of dictionaries with nullable value types changes, purely by including/removing the
protobuf-net.Grpc.AspNetCore.Reflection
package.Setup:
Data contract:
Service:
Client:
WITH package, response =
{ { "test1", "blabla" }, { "test", "" } }
WITHOUT package, response ={ { "test1", "blabla" }, { "test", null } }
I'm using protobuf-net.Grpc.AspNetCore.Reflection --version 1.1.1