Optimize data-driven test display names - #11019
Merged
Amaury Levé (Evangelink) merged 3 commits intoSep 4, 2026
Merged
Conversation
Cache method metadata and localized formats, reuse bounded thread-local builders, and avoid array enumerator allocations in data-row display-name generation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: dbdc5d12-fd8e-4443-96e3-55161b6ee867
Copilot started reviewing on behalf of
Amaury Levé (Evangelink)
September 3, 2026 17:06
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add coverage verifying localized-format cache refresh after changing CurrentUICulture on the same thread.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/TestFramework/TestFramework/Internal/TestDataSourceUtilities.cs — Add a test that invokes display-name generation twice on the same thread, switches… |
What changed in this PR
Optimizes data-driven test display-name generation while preserving culture-sensitive formatting.
Changes:
- Caches method metadata and localized formats.
- Reuses bounded thread-local
StringBuilderinstances. - Iterates object arrays directly.
| File | Description |
|---|---|
src/TestFramework/TestFramework/Internal/TestDataSourceUtilities.cs |
Adds reflection, resource, builder, and array-processing optimizations. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Verify consecutive display-name generation on one thread refreshes the cached format when CurrentUICulture changes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: dbdc5d12-fd8e-4443-96e3-55161b6ee867
Copilot started reviewing on behalf of
Amaury Levé (Evangelink)
September 3, 2026 17:18
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The reviewed optimizations preserve expected behavior and have no unresolved issues.
Review tier: Balanced
Findings: None
Issues resolved since last review (1)
| Severity | Finding |
|---|---|
src/TestFramework/TestFramework/Internal/TestDataSourceUtilities.cs — Add a test that invokes display-name generation twice on the same thread, switches… View resolved comment |
The replacement Azure pipeline passed all stages, but its result was not attached to the pull request's required check. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: dbdc5d12-fd8e-4443-96e3-55161b6ee867
Petr Pokorny (0101)
approved these changes
Sep 4, 2026
Amaury Levé (Evangelink)
deleted the
dev/amauryleve/mtp-performance-analysis
branch
September 4, 2026 10:09
Amaury Levé (Evangelink)
restored the
dev/amauryleve/mtp-performance-analysis
branch
September 4, 2026 10:09
Amaury Levé (Evangelink)
deleted the
dev/amauryleve/mtp-performance-analysis
branch
September 4, 2026 10:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Filtrace analysis identified repeated reflection, resource lookup locking, StringBuilder growth, and array enumeration as hotspots when generating data-driven test display names.
Cache immutable method metadata and localized formats, reuse bounded thread-local StringBuilder instances, and iterate object arrays directly while preserving culture-sensitive behavior.
BenchmarkDotNet MediumRun results:
TestFramework unit tests pass on net48, net8.0, net8.0-windows, and net9.0.