The protobuf-net RuntimeTypeModel class has a function TryGetRepeatedProvider which checks if a C# data type is a proto’s “repeated” type and its c# System.Reflection.MemeberInfo type is present (e.g. string[] or List or Dictionary<T,K>) then do not create its proto schema.
Example:
c# Dictionary<string,string[]> is not getting converted to proto schema :
// below Array_String message is not getting generated.
message Array_String {
repeated string item = 1;
}
// KeyValuePair_String_Array_String message is getting generated
message KeyValuePair_String_Array_String {
string Key = 1;
Array_String Value = 2; // getting generated too
}
the message Array_String is not getting generated because c# string[] System.Reflection.Memberinfo type is available to RuntimeTypeModel.
-
When c# System.Reflection.Memberinfo type is available why its message
is not generated in proto? -
If those are not generated then the above-mentioned complex types are
not working, what could be a workaround? -
If we try to bypass the below mentioned check in RuntimeTypeModel
class’s GetSchema function what could go wrong ?This instruction :
TryGetRepeatedProvider(tmp.Type) is not null) continue;
Dictionary<string,string[]> or Dictionary<string,Dictionary<string,string>> these c# types should be parsed and their proto schema should be generated.