Skip to content

Due to protobuf-net RuntimeTypeModel class, the complex datatype such as Dictionary<string,string[]> are not getting converted to corresponding proto schema #351

Open
@atulDc

Description

@atulDc

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.

Below 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 class of protobuf-net library.

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 ?

Bypassing this instruction :

TryGetRepeatedProvider(tmp.Type) is not null) continue;

The bottom line is:
Dictionary<string,string[]> or Dictionary<string,Dictionary<string,string>> these c# types should be parsed and their proto schema should be generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions