protobuf-net / protobuf-net.Grpc

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

Reflection skips properties of type Dictionary<(Tuple with nullable type), T> #288

Open JuliusSweetland opened 1 year ago

JuliusSweetland commented 1 year ago

I have a property as below. When I enable reflection and attempt to dump a proto file from the running service using the command below the proto is generated, but is missing this property. No errors/warnings are displayed on the cli.

Experimenting it works if I replace the tuple with a struct of my own (e.g. public struct LongAndNullableDouble), or if I make the double non-nullable then the property is included in the dumped proto.

Command:

dotnet grpc-cli dump http://localhost:5000 MyService

Property that is NOT included in the proto:

[ProtoMember(3)]
public Dictionary<(long, double?), int>? MyProperty { get; set; }

But this property is included:

[ProtoMember(3)]
public Dictionary<(long, double), int>? MyProperty { get; set; }

and output like this:

repeated MyService.KeyValuePair_ValueTuple_Int64_Double_Int32 MyProperty = 3;
JuliusSweetland commented 1 year ago

@mgravell Hi Marc - sorry to tag you in, but do you have any insight into what might be going wrong here? I'll tag you on the potentially related second issue as well. Thank you.

mgravell commented 1 year ago

Nope; I saw it initially - looks very curious, but I have not yet had chance to investigate. I'm intrigued - I just don't have infinite time :)

JuliusSweetland commented 1 year ago

@mgravell Completely understand. I have an open source project as well and appreciate the pain.

JuliusSweetland commented 1 year ago

Is anyone able to give a bit of guidance on this one? Thanks.