Protocol buffers and C#

Viewed 18

I have:

#1 got a .proto file and run protoc.exe to generate the C# interface file.

#2 created a blank WPF application, added the generated file, and added the Google.protobuf nuget package.

#3 Loaded the file as a byte array and attempted to read the DataGeneric that was created for me.

#4 The program dies with a Google.Protobuf.InvalidProtocolBufferException: 'Protocol message contained an invalid tag (zero).'

My simple function that fails:

    private void doit()
    {
        string fn = @"D:\AAAA.pbd2";

        byte[] fb = File.ReadAllBytes(fn);

        DataGeneric data = new DataGeneric();
        data = DataGeneric.Parser.ParseFrom(fb);
    }
0 Answers
Related