Skip to content

Fix several new CA1830 diagnostics#121131

Merged
stephentoub merged 1 commit into
dotnet:mainfrom
stephentoub:moreca1830
Oct 28, 2025
Merged

Fix several new CA1830 diagnostics#121131
stephentoub merged 1 commit into
dotnet:mainfrom
stephentoub:moreca1830

Conversation

@stephentoub

Copy link
Copy Markdown
Member

From updates in dotnet/sdk#51215

Copilot AI review requested due to automatic review settings October 28, 2025 04:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses CA1830 code analyzer diagnostics by replacing inefficient new string(char, int) constructor calls with the more performant StringBuilder.Append(char, int) overload across multiple files in the codebase. This analyzer rule recommends using StringBuilder.Append(char, int) instead of creating temporary string objects when appending repeated characters.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/tools/illink/src/linker/Linker/Driver.cs Updated backslash appending in response file parsing to use the optimized Append overload
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNode.cs Modified indentation string building in ToString() to use the optimized Append overload
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests/CustomConverterTests.ReadAhead.cs Updated test string generation to use the optimized Append overload
src/coreclr/tools/Common/Compiler/ProcessLinkerXmlBase.cs Changed array rank comma separator generation to use the optimized Append overload
src/coreclr/tools/Common/Compiler/DisplayNameHelpers.cs Changed array rank comma separator generation to use the optimized Append overload

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Oct 28, 2025
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Oct 28, 2025
@stephentoub

Copy link
Copy Markdown
Member Author

/ba-g wasm

@stephentoub stephentoub enabled auto-merge (squash) October 28, 2025 12:21
@stephentoub stephentoub merged commit 6445f5b into dotnet:main Oct 28, 2025
135 of 142 checks passed
@stephentoub stephentoub deleted the moreca1830 branch October 28, 2025 12:21
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

linkable-framework Issues associated with delivering a linker friendly framework needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants