Skip to content

avoid some string aloc by using StringBuilder#2055

Merged
twsouthwick merged 3 commits intodotnet:mainfrom
SimonCropp:avoid-some-string-aloc-by-using-StringBuilder
Apr 28, 2026
Merged

avoid some string aloc by using StringBuilder#2055
twsouthwick merged 3 commits intodotnet:mainfrom
SimonCropp:avoid-some-string-aloc-by-using-StringBuilder

Conversation

@SimonCropp
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2026

Test Results

    81 files      81 suites   1h 32m 1s ⏱️
 2 077 tests  2 074 ✅  3 💤 0 ❌
38 006 runs  37 964 ✅ 42 💤 0 ❌

Results for commit 1877bd3.

♻️ This comment has been updated with latest results.

@twsouthwick twsouthwick requested a review from Copilot April 28, 2026 00:31
Copy link
Copy Markdown

Copilot AI left a comment

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 reduces intermediate string allocations in semantic validation error-message construction by replacing repeated string concatenation patterns with StringBuilder.

Changes:

  • Replaced concatenated string building of quoted value lists with StringBuilder in multiple semantic constraint validators.
  • Removed leading-comma + Substring(1) patterns in AttributeMutualExclusive and replaced them with delimiter-aware StringBuilder appends.
Show a summary per file
File Description
src/DocumentFormat.OpenXml.Framework/Validation/Semantic/AttributeValueConditionToAnother.cs Uses StringBuilder to build human-readable quoted value lists for validation messages.
src/DocumentFormat.OpenXml.Framework/Validation/Semantic/AttributeMutualExclusive.cs Uses StringBuilder to build comma-delimited attribute lists without Substring(1) cleanup.
src/DocumentFormat.OpenXml.Framework/Validation/Semantic/AttributeAbsentConditionToValue.cs Uses StringBuilder to build quoted value lists for the error description.
src/DocumentFormat.OpenXml.Framework/Validation/Semantic/AttributeAbsentConditionToNonValue.cs Uses StringBuilder to build quoted value lists (with “and”) for the error description.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/4 changed files
  • Comments generated: 0

@twsouthwick twsouthwick merged commit bff3713 into dotnet:main Apr 28, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants