[ 
https://issues.apache.org/jira/browse/THRIFT-5316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jens Geyer resolved THRIFT-5316.
--------------------------------
    Fix Version/s: 0.14.0
         Assignee: Jens Geyer
       Resolution: Not A Problem

The method is located here
https://github.com/apache/thrift/blob/master/lib/netstd/Thrift/Protocol/ToString.cs#L30

Very likely you are missing a reference to the runtime library.
https://github.com/apache/thrift/tree/master/lib/netstd


> Netstd compiler generates wrong ToString() method: .ToString(sb) 
> -----------------------------------------------------------------
>
>                 Key: THRIFT-5316
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5316
>             Project: Thrift
>          Issue Type: Bug
>          Components: netstd - Compiler
>    Affects Versions: 0.14.0
>            Reporter: Konstantin
>            Assignee: Jens Geyer
>            Priority: Major
>             Fix For: 0.14.0
>
>         Attachments: Test.cs
>
>
> Thrift compiler generate code that doesn't compile netstd: object doesn't 
> have ToString(StringBuilder) overload. 
> Test case: 
> {code}
> struct Test {
>   1: string test_string
>   2: i64 test_i64
>   3: binary test_binary
>   4: map<string, string> test_map
> } 
> {code}
> produces following ToString() method:
> {code:c#}
>     public override string ToString()
>     {
>       var sb = new StringBuilder("Test(");
>       int tmp6 = 0;
>       if((Test_string != null) && __isset.test_string)
>       {
>         if(0 < tmp6++) { sb.Append(", "); }
>         sb.Append("Test_string: ");
>         Test_string.ToString(sb);
>       }
>       if(__isset.test_i64)
>       {
>         if(0 < tmp6++) { sb.Append(", "); }
>         sb.Append("Test_i64: ");
>         Test_i64.ToString(sb);
>       }
>       if((Test_binary != null) && __isset.test_binary)
>       {
>         if(0 < tmp6++) { sb.Append(", "); }
>         sb.Append("Test_binary: ");
>         Test_binary.ToString(sb);
>       }
>       if((Test_map != null) && __isset.test_map)
>       {
>         if(0 < tmp6++) { sb.Append(", "); }
>         sb.Append("Test_map: ");
>         Test_map.ToString(sb);
>       }
>       sb.Append(")");
>       return sb.ToString();
>     }
> {code}
> Test_string.ToString(sb); (and folllowing .ToString(sb)) - produces  build 
> failure:  [CS1503] Argument 1: cannot convert from 
> 'System.Text.StringBuilder' to 'System.IFormatProvider?'
>  
> Full generated class is in attachment



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to