-
-
Couldn't load subscription status.
- Fork 273
Closed
Labels
Description
Product and Version Used:
Roslynator.Analyzera 4.12.4
Steps to Reproduce:
using System.Globalization;
public void foo()
{
Span<char> bar = stackalloc char[6];
bar.TryWrite(CultureInfo.InvariantInfo, $"foobar", out _);
}Actual Behavior:
$"foobar" is marked by RCS1214 as an unnecessary interpolation.
Accepting the code fix and removing the interpolation causes an error:
bar.TryWrite(CultureInfo.InvariantInfo, "foobar", out _);Expected Behavior:
RCS1214 should not apply to interpolation handler parameters, e.g. this ref TryWriteInterpolatedStringHandler.
Probably simpler just not to recommend it here, but it could also suggest a codefix to do something like "foobar".TryCopyTo(bar); instead.