'TProtocol'不包含'IncrementRecursionDepth'的定义

zer*_*ven 2 c# thrift thrift-protocol

我已经为我的库和服务器安装了thrift; 使用NuGet.

我有一个非常简单的thrift文件,我使用以下命令编译它:

thrift.exe -r --gen csharp node.thrift

node.thrift有三行:

service Server {
    string ping()
}
Run Code Online (Sandbox Code Playgroud)

我从thrift编译器生成的Server.cs中获取错误.

'TProtocol'不包含'IncrementRecursionDepth'的定义

抛出错误的示例行:

public void Read (TProtocol iprot)
    {
      iprot.IncrementRecursionDepth(); //this line has the error
Run Code Online (Sandbox Code Playgroud)

我用Google搜索了,但没有找到任何结果.

更新:如果我删除抛出错误的行,库编译并且服务器按预期工作,我不知道将来是否会遇到错误,最后是递归吗?!

重要的一点:我使用我下载的可执行文件编译thrift文件http://www.apache.org/dyn/closer.cgi?path=/thrift/0.9.3/thrift-0.9.3.exe.版本是0.9.3但NuGet安装的thrift库是0.9.1.3

Jen*_*nsG 6

版本是0.9.3但NuGet安装的thrift库是0.9.1.3

这就是问题所在.IncrementRecursionDepth()之后添加了该功能以防止出现问题,THRIFT-3235对此进行了详细介绍.由于您需要编译器和库,因此会出现问题.

解决方案:始终使用匹配的编译器和库.特别是,使用0.9.3.