Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'TProtocol' does not contain a definition for 'IncrementRecursionDepth'

I've installed thrift for both my library and server; using NuGet.

I have a very simple thrift file that I've compiled it using the following command:

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

the node.thrift has three lines:

service Server {
    string ping()
}

I get the errors from the Server.cs generated by the thrift compiler.

'TProtocol' does not contain a definition for 'IncrementRecursionDepth'

sample line throwing the error:

public void Read (TProtocol iprot)
    {
      iprot.IncrementRecursionDepth(); //this line has the error

I've googled for it, but didn't find any results.

update: If I delete the lines throwing the error, the library compiles and the server works as expected, I don't know if I'll face errors in the future or not, whats up with the recursion?!

important point: I compile the thrift file using the executable I've downloaded from http://www.apache.org/dyn/closer.cgi?path=/thrift/0.9.3/thrift-0.9.3.exe. the version is 0.9.3 but the thrift library installed by NuGet is 0.9.1.3

like image 244
aliep Avatar asked Jan 06 '23 11:01

aliep


1 Answers

the version is 0.9.3 but the thrift library installed by NuGet is 0.9.1.3

Thats exactly the problem. The IncrementRecursionDepth() function has been added later to prevent a problem, which is outlined in more detail in THRIFT-3235. Since you need both compiler and library for it, you get a problem.

Solution: Always use matching compiler and libraries. In particular, use 0.9.3.

like image 55
JensG Avatar answered Jan 08 '23 23:01

JensG