You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
syntax = "proto3";
import "google/protobuf/struct.proto";
import "google/protobuf/empty.proto";
service Greeter {
rpc SayHello (google.protobuf.Empty) returns (Status);
}
message Status {
google.protobuf.Value data = 3;
}
As a result, I will get a generated dot with a "data" field of the type Google.Protobuf.WellKnownTypes.Value. I can assign an arbitrary JsonDocument to this "data" in the following way and everything will be transmitted perfectly.
var dto = new Status();
dto.Data = Google.Protobuf.WellKnownTypes.Value.Parser.ParseJson(myJsonDocument.RootElement.ToString())
[DataContract]
public class ObjectTypeDto
{
[DataMember(Order = 1)]
public Google.Protobuf.WellKnownTypes.Value Data { get; set; }
}
If I pass my myJsonDocument through it as before, I get an exception: System.InvalidOperationException: No serializer defined for type: Google.Protobuf.WellKnownTypes.Value
The protobuf format has the type
google.protobuf.Value
described in Create Protobuf messages for .NET apps.There is also a
Google.Protobuf.WellKnownTypes.Value
type in theGoogle.Protobuf, Version=3.28.0.0
library.I can send
google.protobuf.Value
with a message described by such a proto-file:As a result, I will get a generated dot with a "data" field of the type
Google.Protobuf.WellKnownTypes.Value
. I can assign an arbitrary JsonDocument to this "data" in the following way and everything will be transmitted perfectly.I used
protobuf-net.Grpc
and applied code-first by creating such a dto with the fieldGoogle.Protobuf.WellKnownTypes.Value
If I pass my
myJsonDocument
through it as before, I get an exception:System.InvalidOperationException: No serializer defined for type: Google.Protobuf.WellKnownTypes.Value
I used the tool https://protogen.marcgravell.com and generated the following dto from the above proto file:
When I try to return the result from the method in this dto, I get the same exception.
How do I send a
google.protobuf.Value
(Google.Protobuf.WellKnownTypes.Value
) object usingprotobuf-net.Grpc
and code-first?The text was updated successfully, but these errors were encountered: