小编Jea*_*ave的帖子

Google.Protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero)

I have a problem with my school project, i use Protobuf library but i have the following error:

Google.Protobuf.InvalidProtocolBufferException" Protocol message contained an invalid tag (zero).

My protocol message wrapper is:

syntax = "proto3";
package CardGameGUI.Network.Protocol.Message;

message WrapperMessage {
enum MessageType {
    HELLO_MESSAGE = 0;
    JOIN_ROOM_MESSAGE = 1;
    JOIN_ROOM_RESPONSE_MESSAGE = 2;
}

MessageType type = 1;
bytes       payload = 2;
}
Run Code Online (Sandbox Code Playgroud)

我用它来发送消息:

    public void SendObject<T>(Protocol.Message.WrapperMessage.Types.MessageType type, T messageObject)
    {
        byte[] message;

        // Serialize message
        using (var stream = new MemoryStream()) …
Run Code Online (Sandbox Code Playgroud)

c# protobuf-net

5
推荐指数
1
解决办法
5075
查看次数

标签 统计

c# ×1

protobuf-net ×1