Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public static void Analyze(SyntaxNodeAnalysisContext context, in SimpleMemberInv

SimpleMemberInvocationExpressionInfo invocationInfo2 = SyntaxInfo.SimpleMemberInvocationExpressionInfo(invocationInfo.Expression);

if (!invocationInfo2.Success)
return;

if (invocationInfo2.NameText != "Append")
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,25 @@ void M()
var sb = new StringBuilder().Append($""{Foo}Bar"");
}
}
");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.OptimizeStringBuilderAppendCall)]
public async Task TestNoDiagnostic_NoAppendMethodChain()
{
await VerifyNoDiagnosticAsync(@"
using System.Text;

class C
{
string M()
{
var sb = new StringBuilder();
_ = sb.AppendLine();

return sb.ToString();
}
}
");
}
}
4 changes: 4 additions & 0 deletions src/VisualStudioCode/package/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix [RCS1197](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1197) ([PR](https://github.com/dotnet/roslynator/pull/1226)).

## [4.6.0] - 2023-10-18

### Added
Expand Down