[
https://issues.apache.org/jira/browse/THRIFT-5316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Konstantin updated THRIFT-5316:
-------------------------------
Attachment: Test.cs
> 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
> Priority: Major
> 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?'
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)