roslynator
roslynator copied to clipboard
RCS1197 does not know about `AppendInterpolatedStringHandler`
Product and Version Used: v4.1.0
Steps to Reproduce:
C# 10 introduced Improved Interpolated Strings and .NET 6 added an overload StringBuilder.Append(ref AppendInterpolatedStringHandler) which lets you write
new StringBuilder().Append($"13{37}");
and at compile time it is translated into
StringBuilder stringBuilder = new StringBuilder();
StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(2, 1, stringBuilder);
handler.AppendLiteral("13");
handler.AppendFormatted(37);
stringBuilder.Append(ref handler);

Actual Behavior: RCS1197 is reported
Expected Behavior: RCS1197 should not be reported
Confirmed here also, and I think that:
arguments.Append($" CONTENTDIR=\"{destinationPath}\"");
Really does look much clearer than:
arguments.Append(" CONTENTDIR=\"").Append(destinationPath).Append('\"');
😸
any update on this bug?
Confirmed here also, and I think that:
arguments.Append($" CONTENTDIR=\"{destinationPath}\"");Really does look much clearer than:
arguments.Append(" CONTENTDIR=\"").Append(destinationPath).Append('\"');
I agree.
Let's remove cases with interpolated string and string concatenation from RCS1197.