Optimize VSTestBridge property lookup - #10586

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan
Aug 18, 2026
Merged

Optimize VSTestBridge property lookup#10586
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • scan only custom TestCase properties when preserving the original executor URI
  • avoid TestCase.Properties concatenation and key-snapshot allocations on the per-test-case hot path
  • preserve existing behavior for repeated fixups, stored null values, and executor URI replacement
  • add focused regression coverage

Performance

Independent .NET 9 measurements used Microsoft.TestPlatform.ObjectModel 18.8.0, four custom properties, five 5,000,000-call repetitions, and hit-first/hit-last/no-hit scenarios. The original non-capturing predicate was confirmed to be cached; the savings come from avoiding TestCase.Properties enumeration.

ScenarioBeforeAfterBefore allocationAfter allocation
hit-first custom542 ns/call55 ns/call200 B/call64 B/call
hit-last custom593 ns/call190 ns/call200 B/call64 B/call
no hit585 ns/call202 ns/call200 B/call64 B/call

A manual loop retained the same allocations as each corresponding LINQ path, so this keeps the simpler Any expression.

Testing

  • warning-free build for net462, net8.0, and net9.0
  • full Microsoft.Testing.Extensions.VSTestBridge.UnitTests suites: 69/69 (net462), 74/74 (net8.0), 74/74 (net9.0)

Closes#10585

Scan only the custom TestCase property store when preserving the original executor URI, avoiding the built-in property concatenation and key snapshot allocations.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI balanced review requested due to automatic review settings August 13, 2026 18:30
@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 13, 2026

CopilotAI 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

Optimizes the per-test-case VSTest bridge executor URI lookup while preserving existing behavior.

Changes:

  • Scans only stored custom properties.
  • Adds regression coverage for repeated fixups, null values, and URI replacement.
Show a summary per file
FileDescription
ObjectModelConverters.csOptimizes original executor URI detection.
ObjectModelConvertersTests.csCovers fixup behavior and edge cases.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10586

Parallelization — assemblies audited:

Test assemblyScopeWorkersAnalyzer coverage
Microsoft.Testing.Extensions.VSTestBridge.UnitTestsMethodLevel ([assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] in Program.cs, unchanged by this PR)CPU countcoverable once the parallel-safety analyzers ship (attribute-based opt-in)

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — by severity: none.

This PR only touches ObjectModelConverters.FixUpTestCase (production) and adds four new [TestMethod]s plus one private static readonly TestProperty field to ObjectModelConvertersTests.cs. Reviewed against the taxonomy:

  • Category A/B (process-global state / shared paths). None. Every new test constructs its own local TestCase/TestResult instance and reads/writes only that instance's own property bag via SetPropertyValue/GetPropertyValue/GetProperties(). No environment variables, current directory, console, culture, registry, AppContext, or shared filesystem paths are touched.
  • TestProperty.Register static field. The new OriginalExecutorUriProperty field mirrors the existing ClientInfo field: it is initialized once at class-load time (not mutated per test), and TestProperty.Register for a given key/type is idempotent in VSTest's object model — re-registration under the same id is a read-then-return, not a write race. Since the assembly runs at MethodLevel, this would matter if the field were mutated per test, but it never is; not a finding.
  • Category C (declaration reconciliation). No [ResourceLock] / [DoNotParallelize] exists on this class or these methods, and correctly so — none of the four new tests touch a resource that requires coordination.
  • Category D (over-serialization). Not applicable; nothing here is locked or deferred.

No changes to .runsettings, testconfig.json, .csproj/.props/.targets, or the assembly-level [Parallelize] attribute were made by this PR.

Top actions: None — no changes needed for parallel-safety.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 57.9 AIC · ⌖ 11.2 AIC · ⊞ 24.8K · [◷]( · )

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10586

This PR only changes test content in ObjectModelConvertersTests.cs, adding 4 new tests for FixUpTestCase (the method touched by the production optimization). All four are new, focused, single-behavior tests with clear AAA structure and assertions that verify observable state (GetPropertyValue, ExecutorUri). Together they cover: not overwriting an existing original-executor-uri property, capturing it exactly once across repeated calls, replacing the executor URI, and — notably — the edge case of a property explicitly set to a null value, which is exactly the scenario relevant to the Properties.Any(...)GetProperties().Any(...) change in this PR. No high-confidence actionable findings were identified.

GradeTestMutationNotesHow to improve
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
ReplacesExecutorUriWithVSTestBridgeExecutorUri
1/1 killedVerifies the executor URI is replaced with the bridge's own URI.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyExists_
DoesNotOverwriteIt
1/1 killedKills the negation-flip mutation on the existence check; asserts the preserved original value.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyHasNullValue_
StillTreatsItAsExisting
1/1 killedDirectly regression-tests the PR's core change (Properties vs GetProperties) via a null-valued property.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyIsMissing_
CapturesItExactlyOnce
1/1 killedCalling twice and asserting a single, unchanged value kills the "always overwrite" mutation.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 98.1 AIC · ⌖ 3.6 AIC · ⊞ 16.9K · [◷]( · )

@Evangelink
Amaury Levé (Evangelink) merged commit e4f9b7b into mainAug 18, 2026
62 of 65 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/optimize-vstestbridge-property-scan branch August 18, 2026 10:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf-improver] Avoid LINQ Any() delegate allocation in VSTestBridge FixUpTestCase

4 participants

@Evangelink@0101@Youssef1313
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Optimize VSTestBridge property lookup - #10586

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan
Aug 18, 2026
Merged

Optimize VSTestBridge property lookup#10586
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • scan only custom TestCase properties when preserving the original executor URI
  • avoid TestCase.Properties concatenation and key-snapshot allocations on the per-test-case hot path
  • preserve existing behavior for repeated fixups, stored null values, and executor URI replacement
  • add focused regression coverage

Performance

Independent .NET 9 measurements used Microsoft.TestPlatform.ObjectModel 18.8.0, four custom properties, five 5,000,000-call repetitions, and hit-first/hit-last/no-hit scenarios. The original non-capturing predicate was confirmed to be cached; the savings come from avoiding TestCase.Properties enumeration.

ScenarioBeforeAfterBefore allocationAfter allocation
hit-first custom542 ns/call55 ns/call200 B/call64 B/call
hit-last custom593 ns/call190 ns/call200 B/call64 B/call
no hit585 ns/call202 ns/call200 B/call64 B/call

A manual loop retained the same allocations as each corresponding LINQ path, so this keeps the simpler Any expression.

Testing

  • warning-free build for net462, net8.0, and net9.0
  • full Microsoft.Testing.Extensions.VSTestBridge.UnitTests suites: 69/69 (net462), 74/74 (net8.0), 74/74 (net9.0)

Closes#10585

Scan only the custom TestCase property store when preserving the original executor URI, avoiding the built-in property concatenation and key snapshot allocations.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI balanced review requested due to automatic review settings August 13, 2026 18:30
@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 13, 2026

CopilotAI 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

Optimizes the per-test-case VSTest bridge executor URI lookup while preserving existing behavior.

Changes:

  • Scans only stored custom properties.
  • Adds regression coverage for repeated fixups, null values, and URI replacement.
Show a summary per file
FileDescription
ObjectModelConverters.csOptimizes original executor URI detection.
ObjectModelConvertersTests.csCovers fixup behavior and edge cases.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10586

Parallelization — assemblies audited:

Test assemblyScopeWorkersAnalyzer coverage
Microsoft.Testing.Extensions.VSTestBridge.UnitTestsMethodLevel ([assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] in Program.cs, unchanged by this PR)CPU countcoverable once the parallel-safety analyzers ship (attribute-based opt-in)

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — by severity: none.

This PR only touches ObjectModelConverters.FixUpTestCase (production) and adds four new [TestMethod]s plus one private static readonly TestProperty field to ObjectModelConvertersTests.cs. Reviewed against the taxonomy:

  • Category A/B (process-global state / shared paths). None. Every new test constructs its own local TestCase/TestResult instance and reads/writes only that instance's own property bag via SetPropertyValue/GetPropertyValue/GetProperties(). No environment variables, current directory, console, culture, registry, AppContext, or shared filesystem paths are touched.
  • TestProperty.Register static field. The new OriginalExecutorUriProperty field mirrors the existing ClientInfo field: it is initialized once at class-load time (not mutated per test), and TestProperty.Register for a given key/type is idempotent in VSTest's object model — re-registration under the same id is a read-then-return, not a write race. Since the assembly runs at MethodLevel, this would matter if the field were mutated per test, but it never is; not a finding.
  • Category C (declaration reconciliation). No [ResourceLock] / [DoNotParallelize] exists on this class or these methods, and correctly so — none of the four new tests touch a resource that requires coordination.
  • Category D (over-serialization). Not applicable; nothing here is locked or deferred.

No changes to .runsettings, testconfig.json, .csproj/.props/.targets, or the assembly-level [Parallelize] attribute were made by this PR.

Top actions: None — no changes needed for parallel-safety.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 57.9 AIC · ⌖ 11.2 AIC · ⊞ 24.8K · [◷]( · )

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10586

This PR only changes test content in ObjectModelConvertersTests.cs, adding 4 new tests for FixUpTestCase (the method touched by the production optimization). All four are new, focused, single-behavior tests with clear AAA structure and assertions that verify observable state (GetPropertyValue, ExecutorUri). Together they cover: not overwriting an existing original-executor-uri property, capturing it exactly once across repeated calls, replacing the executor URI, and — notably — the edge case of a property explicitly set to a null value, which is exactly the scenario relevant to the Properties.Any(...)GetProperties().Any(...) change in this PR. No high-confidence actionable findings were identified.

GradeTestMutationNotesHow to improve
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
ReplacesExecutorUriWithVSTestBridgeExecutorUri
1/1 killedVerifies the executor URI is replaced with the bridge's own URI.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyExists_
DoesNotOverwriteIt
1/1 killedKills the negation-flip mutation on the existence check; asserts the preserved original value.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyHasNullValue_
StillTreatsItAsExisting
1/1 killedDirectly regression-tests the PR's core change (Properties vs GetProperties) via a null-valued property.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyIsMissing_
CapturesItExactlyOnce
1/1 killedCalling twice and asserting a single, unchanged value kills the "always overwrite" mutation.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 98.1 AIC · ⌖ 3.6 AIC · ⊞ 16.9K · [◷]( · )

@Evangelink
Amaury Levé (Evangelink) merged commit e4f9b7b into mainAug 18, 2026
62 of 65 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/optimize-vstestbridge-property-scan branch August 18, 2026 10:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf-improver] Avoid LINQ Any() delegate allocation in VSTestBridge FixUpTestCase

4 participants

@Evangelink@0101@Youssef1313
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Optimize VSTestBridge property lookup - #10586

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan
Aug 18, 2026
Merged

Optimize VSTestBridge property lookup#10586
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • scan only custom TestCase properties when preserving the original executor URI
  • avoid TestCase.Properties concatenation and key-snapshot allocations on the per-test-case hot path
  • preserve existing behavior for repeated fixups, stored null values, and executor URI replacement
  • add focused regression coverage

Performance

Independent .NET 9 measurements used Microsoft.TestPlatform.ObjectModel 18.8.0, four custom properties, five 5,000,000-call repetitions, and hit-first/hit-last/no-hit scenarios. The original non-capturing predicate was confirmed to be cached; the savings come from avoiding TestCase.Properties enumeration.

ScenarioBeforeAfterBefore allocationAfter allocation
hit-first custom542 ns/call55 ns/call200 B/call64 B/call
hit-last custom593 ns/call190 ns/call200 B/call64 B/call
no hit585 ns/call202 ns/call200 B/call64 B/call

A manual loop retained the same allocations as each corresponding LINQ path, so this keeps the simpler Any expression.

Testing

  • warning-free build for net462, net8.0, and net9.0
  • full Microsoft.Testing.Extensions.VSTestBridge.UnitTests suites: 69/69 (net462), 74/74 (net8.0), 74/74 (net9.0)

Closes#10585

Scan only the custom TestCase property store when preserving the original executor URI, avoiding the built-in property concatenation and key snapshot allocations.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI balanced review requested due to automatic review settings August 13, 2026 18:30
@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 13, 2026

CopilotAI 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

Optimizes the per-test-case VSTest bridge executor URI lookup while preserving existing behavior.

Changes:

  • Scans only stored custom properties.
  • Adds regression coverage for repeated fixups, null values, and URI replacement.
Show a summary per file
FileDescription
ObjectModelConverters.csOptimizes original executor URI detection.
ObjectModelConvertersTests.csCovers fixup behavior and edge cases.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10586

Parallelization — assemblies audited:

Test assemblyScopeWorkersAnalyzer coverage
Microsoft.Testing.Extensions.VSTestBridge.UnitTestsMethodLevel ([assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] in Program.cs, unchanged by this PR)CPU countcoverable once the parallel-safety analyzers ship (attribute-based opt-in)

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — by severity: none.

This PR only touches ObjectModelConverters.FixUpTestCase (production) and adds four new [TestMethod]s plus one private static readonly TestProperty field to ObjectModelConvertersTests.cs. Reviewed against the taxonomy:

  • Category A/B (process-global state / shared paths). None. Every new test constructs its own local TestCase/TestResult instance and reads/writes only that instance's own property bag via SetPropertyValue/GetPropertyValue/GetProperties(). No environment variables, current directory, console, culture, registry, AppContext, or shared filesystem paths are touched.
  • TestProperty.Register static field. The new OriginalExecutorUriProperty field mirrors the existing ClientInfo field: it is initialized once at class-load time (not mutated per test), and TestProperty.Register for a given key/type is idempotent in VSTest's object model — re-registration under the same id is a read-then-return, not a write race. Since the assembly runs at MethodLevel, this would matter if the field were mutated per test, but it never is; not a finding.
  • Category C (declaration reconciliation). No [ResourceLock] / [DoNotParallelize] exists on this class or these methods, and correctly so — none of the four new tests touch a resource that requires coordination.
  • Category D (over-serialization). Not applicable; nothing here is locked or deferred.

No changes to .runsettings, testconfig.json, .csproj/.props/.targets, or the assembly-level [Parallelize] attribute were made by this PR.

Top actions: None — no changes needed for parallel-safety.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 57.9 AIC · ⌖ 11.2 AIC · ⊞ 24.8K · [◷]( · )

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10586

This PR only changes test content in ObjectModelConvertersTests.cs, adding 4 new tests for FixUpTestCase (the method touched by the production optimization). All four are new, focused, single-behavior tests with clear AAA structure and assertions that verify observable state (GetPropertyValue, ExecutorUri). Together they cover: not overwriting an existing original-executor-uri property, capturing it exactly once across repeated calls, replacing the executor URI, and — notably — the edge case of a property explicitly set to a null value, which is exactly the scenario relevant to the Properties.Any(...)GetProperties().Any(...) change in this PR. No high-confidence actionable findings were identified.

GradeTestMutationNotesHow to improve
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
ReplacesExecutorUriWithVSTestBridgeExecutorUri
1/1 killedVerifies the executor URI is replaced with the bridge's own URI.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyExists_
DoesNotOverwriteIt
1/1 killedKills the negation-flip mutation on the existence check; asserts the preserved original value.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyHasNullValue_
StillTreatsItAsExisting
1/1 killedDirectly regression-tests the PR's core change (Properties vs GetProperties) via a null-valued property.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyIsMissing_
CapturesItExactlyOnce
1/1 killedCalling twice and asserting a single, unchanged value kills the "always overwrite" mutation.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 98.1 AIC · ⌖ 3.6 AIC · ⊞ 16.9K · [◷]( · )

@Evangelink
Amaury Levé (Evangelink) merged commit e4f9b7b into mainAug 18, 2026
62 of 65 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/optimize-vstestbridge-property-scan branch August 18, 2026 10:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf-improver] Avoid LINQ Any() delegate allocation in VSTestBridge FixUpTestCase

4 participants

@Evangelink@0101@Youssef1313
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Optimize VSTestBridge property lookup - #10586

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan
Aug 18, 2026
Merged

Optimize VSTestBridge property lookup#10586
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • scan only custom TestCase properties when preserving the original executor URI
  • avoid TestCase.Properties concatenation and key-snapshot allocations on the per-test-case hot path
  • preserve existing behavior for repeated fixups, stored null values, and executor URI replacement
  • add focused regression coverage

Performance

Independent .NET 9 measurements used Microsoft.TestPlatform.ObjectModel 18.8.0, four custom properties, five 5,000,000-call repetitions, and hit-first/hit-last/no-hit scenarios. The original non-capturing predicate was confirmed to be cached; the savings come from avoiding TestCase.Properties enumeration.

ScenarioBeforeAfterBefore allocationAfter allocation
hit-first custom542 ns/call55 ns/call200 B/call64 B/call
hit-last custom593 ns/call190 ns/call200 B/call64 B/call
no hit585 ns/call202 ns/call200 B/call64 B/call

A manual loop retained the same allocations as each corresponding LINQ path, so this keeps the simpler Any expression.

Testing

  • warning-free build for net462, net8.0, and net9.0
  • full Microsoft.Testing.Extensions.VSTestBridge.UnitTests suites: 69/69 (net462), 74/74 (net8.0), 74/74 (net9.0)

Closes#10585

Scan only the custom TestCase property store when preserving the original executor URI, avoiding the built-in property concatenation and key snapshot allocations.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI balanced review requested due to automatic review settings August 13, 2026 18:30
@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 13, 2026

CopilotAI 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

Optimizes the per-test-case VSTest bridge executor URI lookup while preserving existing behavior.

Changes:

  • Scans only stored custom properties.
  • Adds regression coverage for repeated fixups, null values, and URI replacement.
Show a summary per file
FileDescription
ObjectModelConverters.csOptimizes original executor URI detection.
ObjectModelConvertersTests.csCovers fixup behavior and edge cases.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10586

Parallelization — assemblies audited:

Test assemblyScopeWorkersAnalyzer coverage
Microsoft.Testing.Extensions.VSTestBridge.UnitTestsMethodLevel ([assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] in Program.cs, unchanged by this PR)CPU countcoverable once the parallel-safety analyzers ship (attribute-based opt-in)

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — by severity: none.

This PR only touches ObjectModelConverters.FixUpTestCase (production) and adds four new [TestMethod]s plus one private static readonly TestProperty field to ObjectModelConvertersTests.cs. Reviewed against the taxonomy:

  • Category A/B (process-global state / shared paths). None. Every new test constructs its own local TestCase/TestResult instance and reads/writes only that instance's own property bag via SetPropertyValue/GetPropertyValue/GetProperties(). No environment variables, current directory, console, culture, registry, AppContext, or shared filesystem paths are touched.
  • TestProperty.Register static field. The new OriginalExecutorUriProperty field mirrors the existing ClientInfo field: it is initialized once at class-load time (not mutated per test), and TestProperty.Register for a given key/type is idempotent in VSTest's object model — re-registration under the same id is a read-then-return, not a write race. Since the assembly runs at MethodLevel, this would matter if the field were mutated per test, but it never is; not a finding.
  • Category C (declaration reconciliation). No [ResourceLock] / [DoNotParallelize] exists on this class or these methods, and correctly so — none of the four new tests touch a resource that requires coordination.
  • Category D (over-serialization). Not applicable; nothing here is locked or deferred.

No changes to .runsettings, testconfig.json, .csproj/.props/.targets, or the assembly-level [Parallelize] attribute were made by this PR.

Top actions: None — no changes needed for parallel-safety.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 57.9 AIC · ⌖ 11.2 AIC · ⊞ 24.8K · [◷]( · )

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10586

This PR only changes test content in ObjectModelConvertersTests.cs, adding 4 new tests for FixUpTestCase (the method touched by the production optimization). All four are new, focused, single-behavior tests with clear AAA structure and assertions that verify observable state (GetPropertyValue, ExecutorUri). Together they cover: not overwriting an existing original-executor-uri property, capturing it exactly once across repeated calls, replacing the executor URI, and — notably — the edge case of a property explicitly set to a null value, which is exactly the scenario relevant to the Properties.Any(...)GetProperties().Any(...) change in this PR. No high-confidence actionable findings were identified.

GradeTestMutationNotesHow to improve
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
ReplacesExecutorUriWithVSTestBridgeExecutorUri
1/1 killedVerifies the executor URI is replaced with the bridge's own URI.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyExists_
DoesNotOverwriteIt
1/1 killedKills the negation-flip mutation on the existence check; asserts the preserved original value.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyHasNullValue_
StillTreatsItAsExisting
1/1 killedDirectly regression-tests the PR's core change (Properties vs GetProperties) via a null-valued property.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyIsMissing_
CapturesItExactlyOnce
1/1 killedCalling twice and asserting a single, unchanged value kills the "always overwrite" mutation.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 98.1 AIC · ⌖ 3.6 AIC · ⊞ 16.9K · [◷]( · )

@Evangelink
Amaury Levé (Evangelink) merged commit e4f9b7b into mainAug 18, 2026
62 of 65 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/optimize-vstestbridge-property-scan branch August 18, 2026 10:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf-improver] Avoid LINQ Any() delegate allocation in VSTestBridge FixUpTestCase

4 participants

@Evangelink@0101@Youssef1313
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Optimize VSTestBridge property lookup - #10586

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan
Aug 18, 2026
Merged

Optimize VSTestBridge property lookup#10586
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • scan only custom TestCase properties when preserving the original executor URI
  • avoid TestCase.Properties concatenation and key-snapshot allocations on the per-test-case hot path
  • preserve existing behavior for repeated fixups, stored null values, and executor URI replacement
  • add focused regression coverage

Performance

Independent .NET 9 measurements used Microsoft.TestPlatform.ObjectModel 18.8.0, four custom properties, five 5,000,000-call repetitions, and hit-first/hit-last/no-hit scenarios. The original non-capturing predicate was confirmed to be cached; the savings come from avoiding TestCase.Properties enumeration.

ScenarioBeforeAfterBefore allocationAfter allocation
hit-first custom542 ns/call55 ns/call200 B/call64 B/call
hit-last custom593 ns/call190 ns/call200 B/call64 B/call
no hit585 ns/call202 ns/call200 B/call64 B/call

A manual loop retained the same allocations as each corresponding LINQ path, so this keeps the simpler Any expression.

Testing

  • warning-free build for net462, net8.0, and net9.0
  • full Microsoft.Testing.Extensions.VSTestBridge.UnitTests suites: 69/69 (net462), 74/74 (net8.0), 74/74 (net9.0)

Closes#10585

Scan only the custom TestCase property store when preserving the original executor URI, avoiding the built-in property concatenation and key snapshot allocations.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI balanced review requested due to automatic review settings August 13, 2026 18:30
@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 13, 2026

CopilotAI 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

Optimizes the per-test-case VSTest bridge executor URI lookup while preserving existing behavior.

Changes:

  • Scans only stored custom properties.
  • Adds regression coverage for repeated fixups, null values, and URI replacement.
Show a summary per file
FileDescription
ObjectModelConverters.csOptimizes original executor URI detection.
ObjectModelConvertersTests.csCovers fixup behavior and edge cases.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10586

Parallelization — assemblies audited:

Test assemblyScopeWorkersAnalyzer coverage
Microsoft.Testing.Extensions.VSTestBridge.UnitTestsMethodLevel ([assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] in Program.cs, unchanged by this PR)CPU countcoverable once the parallel-safety analyzers ship (attribute-based opt-in)

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — by severity: none.

This PR only touches ObjectModelConverters.FixUpTestCase (production) and adds four new [TestMethod]s plus one private static readonly TestProperty field to ObjectModelConvertersTests.cs. Reviewed against the taxonomy:

  • Category A/B (process-global state / shared paths). None. Every new test constructs its own local TestCase/TestResult instance and reads/writes only that instance's own property bag via SetPropertyValue/GetPropertyValue/GetProperties(). No environment variables, current directory, console, culture, registry, AppContext, or shared filesystem paths are touched.
  • TestProperty.Register static field. The new OriginalExecutorUriProperty field mirrors the existing ClientInfo field: it is initialized once at class-load time (not mutated per test), and TestProperty.Register for a given key/type is idempotent in VSTest's object model — re-registration under the same id is a read-then-return, not a write race. Since the assembly runs at MethodLevel, this would matter if the field were mutated per test, but it never is; not a finding.
  • Category C (declaration reconciliation). No [ResourceLock] / [DoNotParallelize] exists on this class or these methods, and correctly so — none of the four new tests touch a resource that requires coordination.
  • Category D (over-serialization). Not applicable; nothing here is locked or deferred.

No changes to .runsettings, testconfig.json, .csproj/.props/.targets, or the assembly-level [Parallelize] attribute were made by this PR.

Top actions: None — no changes needed for parallel-safety.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 57.9 AIC · ⌖ 11.2 AIC · ⊞ 24.8K · [◷]( · )

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10586

This PR only changes test content in ObjectModelConvertersTests.cs, adding 4 new tests for FixUpTestCase (the method touched by the production optimization). All four are new, focused, single-behavior tests with clear AAA structure and assertions that verify observable state (GetPropertyValue, ExecutorUri). Together they cover: not overwriting an existing original-executor-uri property, capturing it exactly once across repeated calls, replacing the executor URI, and — notably — the edge case of a property explicitly set to a null value, which is exactly the scenario relevant to the Properties.Any(...)GetProperties().Any(...) change in this PR. No high-confidence actionable findings were identified.

GradeTestMutationNotesHow to improve
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
ReplacesExecutorUriWithVSTestBridgeExecutorUri
1/1 killedVerifies the executor URI is replaced with the bridge's own URI.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyExists_
DoesNotOverwriteIt
1/1 killedKills the negation-flip mutation on the existence check; asserts the preserved original value.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyHasNullValue_
StillTreatsItAsExisting
1/1 killedDirectly regression-tests the PR's core change (Properties vs GetProperties) via a null-valued property.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyIsMissing_
CapturesItExactlyOnce
1/1 killedCalling twice and asserting a single, unchanged value kills the "always overwrite" mutation.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 98.1 AIC · ⌖ 3.6 AIC · ⊞ 16.9K · [◷]( · )

@Evangelink
Amaury Levé (Evangelink) merged commit e4f9b7b into mainAug 18, 2026
62 of 65 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/optimize-vstestbridge-property-scan branch August 18, 2026 10:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf-improver] Avoid LINQ Any() delegate allocation in VSTestBridge FixUpTestCase

4 participants

@Evangelink@0101@Youssef1313
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Optimize VSTestBridge property lookup - #10586

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan
Aug 18, 2026
Merged

Optimize VSTestBridge property lookup#10586
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • scan only custom TestCase properties when preserving the original executor URI
  • avoid TestCase.Properties concatenation and key-snapshot allocations on the per-test-case hot path
  • preserve existing behavior for repeated fixups, stored null values, and executor URI replacement
  • add focused regression coverage

Performance

Independent .NET 9 measurements used Microsoft.TestPlatform.ObjectModel 18.8.0, four custom properties, five 5,000,000-call repetitions, and hit-first/hit-last/no-hit scenarios. The original non-capturing predicate was confirmed to be cached; the savings come from avoiding TestCase.Properties enumeration.

ScenarioBeforeAfterBefore allocationAfter allocation
hit-first custom542 ns/call55 ns/call200 B/call64 B/call
hit-last custom593 ns/call190 ns/call200 B/call64 B/call
no hit585 ns/call202 ns/call200 B/call64 B/call

A manual loop retained the same allocations as each corresponding LINQ path, so this keeps the simpler Any expression.

Testing

  • warning-free build for net462, net8.0, and net9.0
  • full Microsoft.Testing.Extensions.VSTestBridge.UnitTests suites: 69/69 (net462), 74/74 (net8.0), 74/74 (net9.0)

Closes#10585

Scan only the custom TestCase property store when preserving the original executor URI, avoiding the built-in property concatenation and key snapshot allocations.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI balanced review requested due to automatic review settings August 13, 2026 18:30
@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 13, 2026

CopilotAI 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

Optimizes the per-test-case VSTest bridge executor URI lookup while preserving existing behavior.

Changes:

  • Scans only stored custom properties.
  • Adds regression coverage for repeated fixups, null values, and URI replacement.
Show a summary per file
FileDescription
ObjectModelConverters.csOptimizes original executor URI detection.
ObjectModelConvertersTests.csCovers fixup behavior and edge cases.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10586

Parallelization — assemblies audited:

Test assemblyScopeWorkersAnalyzer coverage
Microsoft.Testing.Extensions.VSTestBridge.UnitTestsMethodLevel ([assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] in Program.cs, unchanged by this PR)CPU countcoverable once the parallel-safety analyzers ship (attribute-based opt-in)

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — by severity: none.

This PR only touches ObjectModelConverters.FixUpTestCase (production) and adds four new [TestMethod]s plus one private static readonly TestProperty field to ObjectModelConvertersTests.cs. Reviewed against the taxonomy:

  • Category A/B (process-global state / shared paths). None. Every new test constructs its own local TestCase/TestResult instance and reads/writes only that instance's own property bag via SetPropertyValue/GetPropertyValue/GetProperties(). No environment variables, current directory, console, culture, registry, AppContext, or shared filesystem paths are touched.
  • TestProperty.Register static field. The new OriginalExecutorUriProperty field mirrors the existing ClientInfo field: it is initialized once at class-load time (not mutated per test), and TestProperty.Register for a given key/type is idempotent in VSTest's object model — re-registration under the same id is a read-then-return, not a write race. Since the assembly runs at MethodLevel, this would matter if the field were mutated per test, but it never is; not a finding.
  • Category C (declaration reconciliation). No [ResourceLock] / [DoNotParallelize] exists on this class or these methods, and correctly so — none of the four new tests touch a resource that requires coordination.
  • Category D (over-serialization). Not applicable; nothing here is locked or deferred.

No changes to .runsettings, testconfig.json, .csproj/.props/.targets, or the assembly-level [Parallelize] attribute were made by this PR.

Top actions: None — no changes needed for parallel-safety.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 57.9 AIC · ⌖ 11.2 AIC · ⊞ 24.8K · [◷]( · )

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10586

This PR only changes test content in ObjectModelConvertersTests.cs, adding 4 new tests for FixUpTestCase (the method touched by the production optimization). All four are new, focused, single-behavior tests with clear AAA structure and assertions that verify observable state (GetPropertyValue, ExecutorUri). Together they cover: not overwriting an existing original-executor-uri property, capturing it exactly once across repeated calls, replacing the executor URI, and — notably — the edge case of a property explicitly set to a null value, which is exactly the scenario relevant to the Properties.Any(...)GetProperties().Any(...) change in this PR. No high-confidence actionable findings were identified.

GradeTestMutationNotesHow to improve
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
ReplacesExecutorUriWithVSTestBridgeExecutorUri
1/1 killedVerifies the executor URI is replaced with the bridge's own URI.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyExists_
DoesNotOverwriteIt
1/1 killedKills the negation-flip mutation on the existence check; asserts the preserved original value.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyHasNullValue_
StillTreatsItAsExisting
1/1 killedDirectly regression-tests the PR's core change (Properties vs GetProperties) via a null-valued property.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyIsMissing_
CapturesItExactlyOnce
1/1 killedCalling twice and asserting a single, unchanged value kills the "always overwrite" mutation.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 98.1 AIC · ⌖ 3.6 AIC · ⊞ 16.9K · [◷]( · )

@Evangelink
Amaury Levé (Evangelink) merged commit e4f9b7b into mainAug 18, 2026
62 of 65 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/optimize-vstestbridge-property-scan branch August 18, 2026 10:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf-improver] Avoid LINQ Any() delegate allocation in VSTestBridge FixUpTestCase

4 participants

@Evangelink@0101@Youssef1313
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Optimize VSTestBridge property lookup - #10586

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan
Aug 18, 2026
Merged

Optimize VSTestBridge property lookup#10586
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • scan only custom TestCase properties when preserving the original executor URI
  • avoid TestCase.Properties concatenation and key-snapshot allocations on the per-test-case hot path
  • preserve existing behavior for repeated fixups, stored null values, and executor URI replacement
  • add focused regression coverage

Performance

Independent .NET 9 measurements used Microsoft.TestPlatform.ObjectModel 18.8.0, four custom properties, five 5,000,000-call repetitions, and hit-first/hit-last/no-hit scenarios. The original non-capturing predicate was confirmed to be cached; the savings come from avoiding TestCase.Properties enumeration.

ScenarioBeforeAfterBefore allocationAfter allocation
hit-first custom542 ns/call55 ns/call200 B/call64 B/call
hit-last custom593 ns/call190 ns/call200 B/call64 B/call
no hit585 ns/call202 ns/call200 B/call64 B/call

A manual loop retained the same allocations as each corresponding LINQ path, so this keeps the simpler Any expression.

Testing

  • warning-free build for net462, net8.0, and net9.0
  • full Microsoft.Testing.Extensions.VSTestBridge.UnitTests suites: 69/69 (net462), 74/74 (net8.0), 74/74 (net9.0)

Closes#10585

Scan only the custom TestCase property store when preserving the original executor URI, avoiding the built-in property concatenation and key snapshot allocations.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI balanced review requested due to automatic review settings August 13, 2026 18:30
@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 13, 2026

CopilotAI 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

Optimizes the per-test-case VSTest bridge executor URI lookup while preserving existing behavior.

Changes:

  • Scans only stored custom properties.
  • Adds regression coverage for repeated fixups, null values, and URI replacement.
Show a summary per file
FileDescription
ObjectModelConverters.csOptimizes original executor URI detection.
ObjectModelConvertersTests.csCovers fixup behavior and edge cases.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10586

Parallelization — assemblies audited:

Test assemblyScopeWorkersAnalyzer coverage
Microsoft.Testing.Extensions.VSTestBridge.UnitTestsMethodLevel ([assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] in Program.cs, unchanged by this PR)CPU countcoverable once the parallel-safety analyzers ship (attribute-based opt-in)

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — by severity: none.

This PR only touches ObjectModelConverters.FixUpTestCase (production) and adds four new [TestMethod]s plus one private static readonly TestProperty field to ObjectModelConvertersTests.cs. Reviewed against the taxonomy:

  • Category A/B (process-global state / shared paths). None. Every new test constructs its own local TestCase/TestResult instance and reads/writes only that instance's own property bag via SetPropertyValue/GetPropertyValue/GetProperties(). No environment variables, current directory, console, culture, registry, AppContext, or shared filesystem paths are touched.
  • TestProperty.Register static field. The new OriginalExecutorUriProperty field mirrors the existing ClientInfo field: it is initialized once at class-load time (not mutated per test), and TestProperty.Register for a given key/type is idempotent in VSTest's object model — re-registration under the same id is a read-then-return, not a write race. Since the assembly runs at MethodLevel, this would matter if the field were mutated per test, but it never is; not a finding.
  • Category C (declaration reconciliation). No [ResourceLock] / [DoNotParallelize] exists on this class or these methods, and correctly so — none of the four new tests touch a resource that requires coordination.
  • Category D (over-serialization). Not applicable; nothing here is locked or deferred.

No changes to .runsettings, testconfig.json, .csproj/.props/.targets, or the assembly-level [Parallelize] attribute were made by this PR.

Top actions: None — no changes needed for parallel-safety.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 57.9 AIC · ⌖ 11.2 AIC · ⊞ 24.8K · [◷]( · )

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10586

This PR only changes test content in ObjectModelConvertersTests.cs, adding 4 new tests for FixUpTestCase (the method touched by the production optimization). All four are new, focused, single-behavior tests with clear AAA structure and assertions that verify observable state (GetPropertyValue, ExecutorUri). Together they cover: not overwriting an existing original-executor-uri property, capturing it exactly once across repeated calls, replacing the executor URI, and — notably — the edge case of a property explicitly set to a null value, which is exactly the scenario relevant to the Properties.Any(...)GetProperties().Any(...) change in this PR. No high-confidence actionable findings were identified.

GradeTestMutationNotesHow to improve
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
ReplacesExecutorUriWithVSTestBridgeExecutorUri
1/1 killedVerifies the executor URI is replaced with the bridge's own URI.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyExists_
DoesNotOverwriteIt
1/1 killedKills the negation-flip mutation on the existence check; asserts the preserved original value.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyHasNullValue_
StillTreatsItAsExisting
1/1 killedDirectly regression-tests the PR's core change (Properties vs GetProperties) via a null-valued property.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyIsMissing_
CapturesItExactlyOnce
1/1 killedCalling twice and asserting a single, unchanged value kills the "always overwrite" mutation.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 98.1 AIC · ⌖ 3.6 AIC · ⊞ 16.9K · [◷]( · )

@Evangelink
Amaury Levé (Evangelink) merged commit e4f9b7b into mainAug 18, 2026
62 of 65 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/optimize-vstestbridge-property-scan branch August 18, 2026 10:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf-improver] Avoid LINQ Any() delegate allocation in VSTestBridge FixUpTestCase

4 participants

@Evangelink@0101@Youssef1313
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Optimize VSTestBridge property lookup - #10586

Merged
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan
Aug 18, 2026
Merged

Optimize VSTestBridge property lookup#10586
Amaury Levé (Evangelink) merged 1 commit into
mainfrom
dev/amauryleve/optimize-vstestbridge-property-scan

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Summary

  • scan only custom TestCase properties when preserving the original executor URI
  • avoid TestCase.Properties concatenation and key-snapshot allocations on the per-test-case hot path
  • preserve existing behavior for repeated fixups, stored null values, and executor URI replacement
  • add focused regression coverage

Performance

Independent .NET 9 measurements used Microsoft.TestPlatform.ObjectModel 18.8.0, four custom properties, five 5,000,000-call repetitions, and hit-first/hit-last/no-hit scenarios. The original non-capturing predicate was confirmed to be cached; the savings come from avoiding TestCase.Properties enumeration.

ScenarioBeforeAfterBefore allocationAfter allocation
hit-first custom542 ns/call55 ns/call200 B/call64 B/call
hit-last custom593 ns/call190 ns/call200 B/call64 B/call
no hit585 ns/call202 ns/call200 B/call64 B/call

A manual loop retained the same allocations as each corresponding LINQ path, so this keeps the simpler Any expression.

Testing

  • warning-free build for net462, net8.0, and net9.0
  • full Microsoft.Testing.Extensions.VSTestBridge.UnitTests suites: 69/69 (net462), 74/74 (net8.0), 74/74 (net9.0)

Closes#10585

Scan only the custom TestCase property store when preserving the original executor URI, avoiding the built-in property concatenation and key snapshot allocations.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CopilotAI balanced review requested due to automatic review settings August 13, 2026 18:30
@EvangelinkAmaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Aug 13, 2026

CopilotAI 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

Optimizes the per-test-case VSTest bridge executor URI lookup while preserving existing behavior.

Changes:

  • Scans only stored custom properties.
  • Adds regression coverage for repeated fixups, null values, and URI replacement.
Show a summary per file
FileDescription
ObjectModelConverters.csOptimizes original executor URI detection.
ObjectModelConvertersTests.csCovers fixup behavior and edge cases.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

🧵 Parallel-safety audit — PR #10586

Parallelization — assemblies audited:

Test assemblyScopeWorkersAnalyzer coverage
Microsoft.Testing.Extensions.VSTestBridge.UnitTestsMethodLevel ([assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] in Program.cs, unchanged by this PR)CPU countcoverable once the parallel-safety analyzers ship (attribute-based opt-in)

Findings: A (global-state) 0 · B (paths) 0 · C (declaration) 0 · D (over-serialization) 0 — by severity: none.

This PR only touches ObjectModelConverters.FixUpTestCase (production) and adds four new [TestMethod]s plus one private static readonly TestProperty field to ObjectModelConvertersTests.cs. Reviewed against the taxonomy:

  • Category A/B (process-global state / shared paths). None. Every new test constructs its own local TestCase/TestResult instance and reads/writes only that instance's own property bag via SetPropertyValue/GetPropertyValue/GetProperties(). No environment variables, current directory, console, culture, registry, AppContext, or shared filesystem paths are touched.
  • TestProperty.Register static field. The new OriginalExecutorUriProperty field mirrors the existing ClientInfo field: it is initialized once at class-load time (not mutated per test), and TestProperty.Register for a given key/type is idempotent in VSTest's object model — re-registration under the same id is a read-then-return, not a write race. Since the assembly runs at MethodLevel, this would matter if the field were mutated per test, but it never is; not a finding.
  • Category C (declaration reconciliation). No [ResourceLock] / [DoNotParallelize] exists on this class or these methods, and correctly so — none of the four new tests touch a resource that requires coordination.
  • Category D (over-serialization). Not applicable; nothing here is locked or deferred.

No changes to .runsettings, testconfig.json, .csproj/.props/.targets, or the assembly-level [Parallelize] attribute were made by this PR.

Top actions: None — no changes needed for parallel-safety.

Advisory only — heuristic, non-blocking. Re-run with /parallel-audit. This audit answers "is it parallel-safe?"; for testability, smells, or flakiness see the detect-static-dependencies / test-smell-detection / test-anti-patterns analyses.

🤖 Automated content by GitHub Copilot. Generated by the Parallel-safety audit on PR (on open / sync) workflow. · auto · 57.9 AIC · ⌖ 11.2 AIC · ⊞ 24.8K · [◷]( · )

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Expert test review — PR #10586

This PR only changes test content in ObjectModelConvertersTests.cs, adding 4 new tests for FixUpTestCase (the method touched by the production optimization). All four are new, focused, single-behavior tests with clear AAA structure and assertions that verify observable state (GetPropertyValue, ExecutorUri). Together they cover: not overwriting an existing original-executor-uri property, capturing it exactly once across repeated calls, replacing the executor URI, and — notably — the edge case of a property explicitly set to a null value, which is exactly the scenario relevant to the Properties.Any(...)GetProperties().Any(...) change in this PR. No high-confidence actionable findings were identified.

GradeTestMutationNotesHow to improve
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
ReplacesExecutorUriWithVSTestBridgeExecutorUri
1/1 killedVerifies the executor URI is replaced with the bridge's own URI.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyExists_
DoesNotOverwriteIt
1/1 killedKills the negation-flip mutation on the existence check; asserts the preserved original value.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyHasNullValue_
StillTreatsItAsExisting
1/1 killedDirectly regression-tests the PR's core change (Properties vs GetProperties) via a null-valued property.
A (90–100)new ObjectModelConvertersTests.
FixUpTestCase_
WhenOriginalExecutorUriPropertyIsMissing_
CapturesItExactlyOnce
1/1 killedCalling twice and asserting a single, unchanged value kills the "always overwrite" mutation.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Suggestions on the Files
changed tab can be applied with one click. Re-run with
/review-tests.

🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 98.1 AIC · ⌖ 3.6 AIC · ⊞ 16.9K · [◷]( · )

@Evangelink
Amaury Levé (Evangelink) merged commit e4f9b7b into mainAug 18, 2026
62 of 65 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/optimize-vstestbridge-property-scan branch August 18, 2026 10:27
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-reviewAwaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[perf-improver] Avoid LINQ Any() delegate allocation in VSTestBridge FixUpTestCase

4 participants

@Evangelink@0101@Youssef1313