From: Jens Geyer Date: Thu, 2 May 2013 17:29:42 +0000 (+0200) Subject: THRIFT-1955 Union Type writer generated in C# does not WriteStructBegin X-Git-Tag: 0.9.1~134 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=d708ebb6890c58111f05db781927d07a5ce0e9f3;p=common%2Fthrift.git THRIFT-1955 Union Type writer generated in C# does not WriteStructBegin Patch: Carl Yeksigian --- diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc index f0972cf1..90336a65 100644 --- a/compiler/cpp/src/generate/t_csharp_generator.cc +++ b/compiler/cpp/src/generate/t_csharp_generator.cc @@ -1027,6 +1027,9 @@ void t_csharp_generator::generate_csharp_union_class(std::ofstream& out, t_struc indent(out) << "}" << endl; indent(out) << "public override void Write(TProtocol oprot) {" << endl; indent_up(); + indent(out) << "TStruct struc = new TStruct(\"" << tunion->get_name() << "\");" << endl; + indent(out) << "oprot.WriteStructBegin(struc);" << endl; + indent(out) << "TField field = new TField();" << endl; indent(out) << "field.Name = \"" << tfield->get_name() << "\";" << endl; indent(out) << "field.Type = " << type_to_enum(tfield->get_type()) << ";" << endl;