You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expand MSTest analyzer and code-fix test coverage - #12256
Expand the safety net for previously uncovered MSTest analyzer and code-fix behavior: framework/signature boundaries, metadata-only attributes, stale diagnostics, full fixed-source output, custom fix-all, and linked Roslyn/compatibility helpers.
Production code, dependencies, coverage configuration/exclusions, and test scheduling are unchanged. This is progress toward, not a claim of, 100% coverage.
Design and decision record
This is a test-only change, so no separate feature design record is needed. It reuses the established source-built MSTest/Roslyn verifiers and per-test workspaces rather than changing shipping APIs, adding dependencies, or excluding difficult code from coverage.
Helper tests use real Roslyn symbols/operations, including the pinned implementation's parenthesized operation, without implementing reserved Roslyn interfaces. Process-lifetime checks own their child process and use a ready/release handshake with bounded cleanup. Existing expression-bodied-fixture and invalid/stale-input limitations are characterized, not repaired, in this PR.
Demonstration
N/A for screenshots: no product output or UI changes. The measured coverage and execution tables below provide the relevant text evidence.
Validation and regression proof
Validated source: df9b675dd7b49b6bbd18775d013e05bc5af8a89a plus the test-only patch preserved unchanged in commit 3fce8f9b306c19fdabeb710263dd2809233b4eaa. All 30 delivered C# files were checked against the tested SHA-256 snapshot and retain UTF-8 BOM.
The pinned repository SDK was bootstrapped through the build scripts. The final clean Release build used the repository-local SDK, with no incremental compilation and warnings treated as errors: exit 0, 0 warnings, 0 errors.
Executed from the repository root ($a denotes the task-owned local artifact directory):
Each final unfiltered invocation exited 0 on Windows. The net472 host ran on .NET Framework 4.8.1. Method-level/CPU-count scheduling within each assembly was preserved.
Target
Total
Passed
Failed
Skipped
net10.0
3062
3061
0
1
net11.0
3062
3061
0
1
net472
2997
2996
0
1
Total
9121
9118
0
3
This adds 726 discovered cases per target framework, across 207 new methods and 3 extended existing methods. The only skip is the unchanged Unix-only MissingOutputPathWithInheritedCrashDumpSettingsDoesNotProduceDump, once per target.
An earlier combined all-TFM invocation hit the pre-existing GlobalConfigGeneratorContinuationTests.ConflictingDuplicateRuleFailsWithoutPartialConfigurations temporary-DLL cleanup UnauthorizedAccessException on net11.0 (also observed during the unchanged baseline). No new test failed in that run. It is retained as a validation limitation, not erased by the final clean, separate per-target invocations.
TRX, CTRF and JUnit were parsed and reconciled for every target. Coverage exports used exactly the three successful final root .coverage files, not failed runs or duplicate merged inputs:
$inputs=@(Get-ChildItem-LiteralPath "$a\pr-verified"-Filter '*.coverage'-File |Sort-Object Name |Select-Object-ExpandProperty FullName)
.\.dotnet\dotnet.exe coverage merge $inputs--output "$a\pr-verified\coverage.cobertura.xml"--output-format cobertura
.\.dotnet\dotnet.exe coverage merge $inputs--output "$a\pr-verified\coverage.native.xml"--output-format xml
Both exports exited 0. Complete production image identities and denominators match the baseline; no exclusion, suppression, source deletion or denominator reduction was used.
Complete assembly
Final touched lines (Cobertura)
Final fully covered lines (native)
MSTest.Analyzers
8383 / 8412 (99.66%)
9286 / 9693 (95.80%)
MSTest.Analyzers.CodeFixes
3027 / 3068 (98.66%)
3102 / 3233 (95.95%)
For the directly comparable net10.0-only runs, touched-line coverage increased from 7764/8412 (92.30%) to 8382/8412 (99.64%) for analyzers and 2738/3068 (89.24%) to 3027/3068 (98.66%) for code fixes. The table above includes the union of all three targets.
Touched lines, native full/partial lines, and basic blocks are different metrics. The collector supplies no branch/condition denominator; its branch-rate=1 is not treated as measured 100% branch coverage. Remaining gaps include caller-invariant fallbacks, generated members, Release-elided DEBUG helpers and process-exit race paths; not every residual path is proved unreachable.
Local binlogs, parsed result records, both coverage formats and complete residual inventories are retained in the session artifacts, not uploaded as inaccessible local-path links. The exact commands, counts and measurements are included here for reproduction; CI verification of the published head is pending. Package/acceptance, Debug, Linux and macOS runs were not performed for this test-only change.
Test-value evidence
These are safety-net/characterization additions on unchanged production behavior, not a product bug fix or new feature. The existing suite was green before implementation. Assertion sensitivity has been reviewed statically; no deliberate production mutation or empirical mutation-kill result is claimed.
The unchanged net10.0 baseline executed 2336 cases: 2335 passed, 0 failed, 1 pre-existing skip. Final execution is reported above; compiler/fixture-development failures are not counted as behavioral red-phase proof.
Requirement
Evidence
Analyzer diagnostics and invalid/metadata boundaries
Add behavior-focused diagnostic, code-action, metadata, fix-all, and shared-helper cases while preserving production behavior and coverage denominators.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Compared merge base df9b675dd7b49b6bbd18775d013e05bc5af8a89a with head 3fce8f9b306c19fdabeb710263dd2809233b4eaa. Evidence applies to this head, not every intermediate commit.
Test-value evidence
Contract
Evidence
Status
30 test-only files (7,449 added lines, 0 source files changed) adding residual coverage for analyzers, code fixes, and helpers
The diff only adds tests, so it should pass on both revisions. Nothing was built or executed, and no paired execution records were accessible.
Unverified (static only)
The scope is too large for a full per-test review within this run's budget, so the contracts were not individually assessed.
🧵 Parallel safety
PARALLEL-SAFETY RESULT
STATUS: PARTIAL
The specialist analysis was not completed. This is not a clean result. 12 parallelization-configuration candidates were in scope, including the new [assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] snippet text in AnalyzerResidualCoverageTests.cs. That text appears inside test source strings, so it is not an assembly attribute.
Per-test assessment
Pseudo-mutation evidence would consist of static predictions, not executed mutation results.
Result
Quality
Test
Notes
How to improve
Uncertain
—
mod AnalyzerHashingTests.* and the other new test classes
Only a sample was read (Combine_AllArities_MatchSeededXxHash32 compares against an independent XxHash32). Full per-test grading was not completed.
Re-run /review-tests on a narrower scope for per-test grades.
No inline comments were published because no verified, actionable finding reached the publication gate. Existing-thread deduplication was not needed for that reason.
<sub>This advisory review is heuristic and non-blocking.
Re-run the combined review with /review-tests, or only the parallel-safety specialist with /parallel-audit.</sub>
The reason will be displayed to describe this comment to others. Learn more.
Note
🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
Scope: 30 test-only files (~7.4k added lines) in MSTest.Analyzers.UnitTests. No production code, public API, resources or IPC changes.
Coverage limits: The diff payload could not be parsed in this run because shell access to it was denied. I reviewed the changed content through the PR commit checkout and a targeted pattern scan. This was not a line-by-line pass through all 7.4k lines, so it is not an all-clear. I did not compile or run the tests.
Finding (1 inline): The tests depend on reflection over Roslyn and analyzer internals (ProductReflection). These are maintainability and brittleness risks, not correctness defects.
Other observations (no action required):
Only analyzer and code-fix tests were added, all in C# with no VB snippets, which matches the repo policy.
The Thread.Sleep, Task.Delay, Environment.SetEnvironmentVariable and Process.Start hits are all inside analyzer-input source strings, not executed by the tests.
Test-value evidence: Not assessed. These are coverage additions and no behavior change is claimed, so green-before/green-after runs on the exact revision are still expected from CI.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The tests can pass without exercising metadata and stale-location guards, while unbounded waits in the cancellation test can hang the suite instead of detecting a regression.
This test-only PR expands the safety net for MSTest analyzers, code fixes, and shared helpers without changing shipping behavior, dependencies, or coverage exclusions.
Changes:
Adds framework, signature, metadata, and unsupported-input boundary cases.
Extends complete fixed-source, stale-diagnostic, and custom fix-all checks.
Adds direct coverage for Roslyn helpers, hashing, compatibility APIs, and process lifetime handling.
Test-value evidence: The description reports successful Windows Release runs for the tested patch preserved in 3fce8f9b306c19fdabeb710263dd2809233b4eaa. This review used static inspection; execution artifacts were not independently verified, and empirical mutation sensitivity remains unproven.
All paths below are relative to test/UnitTests/MSTest.Analyzers.UnitTests/.
Compared merge base df9b675dd7b49b6bbd18775d013e05bc5af8a89a with head 8e84c3118db0b9399815e8ad48056ec159963064. Evidence applies to this head, not every intermediate commit.
Test-value evidence
Contract
Evidence
Status
Test-only safety net for analyzers, code fixes and helpers (30 files, 0 source files changed)
Behavior-preserving additions are expected to pass on both revisions. The PR body reports Windows Release runs on net10.0, net11.0 and net472, but no paired execution records for this head were accessible here.
Unverified (static only)
Head commit 8e84c3118 tightens earlier weak spots: the fixture-signature CannotFix opt-out is tested separately, and guard-fixer invalid-metadata tests now first assert that one action is registered for a valid diagnostic and then assert none for the invalid one. It also moves the child-process handshake to a bounded WaitForCompletionAsync.
Static reading of the delta: the valid-then-invalid pairing means an always-empty result would now fail the first assertion, and the waits are bounded.
Static prediction: protective
The three open threads from the earlier head (CannotFix opt-out masking, metadata guard bypassing registration, unbounded cancellation wait) appear addressed by this head. This review did not re-verify the threads' disposition. Contracts in the remaining files were not individually assessed within this run's budget.
🧵 Parallel safety
PARALLEL-SAFETY RESULT
STATUS: PARTIAL
The specialist analysis was not run in this pass, so this is not a clean result. The PR states that scheduling and parallelization configuration are unchanged. The 12 configuration candidates are test-source strings (for example [assembly: Parallelize(...)] snippets inside analyzer inputs), not assembly attributes. The process-lifetime tests own their child process and release or kill it in finally.
Per-test assessment
Pseudo-mutation evidence below consists of static predictions, not executed mutation results.
Result
Quality
Test
Notes
How to improve
Uncertain
—
mod CodeFixRegistrationContinuationTests.GuardFixers_InvalidMetadata_DoNotRegisterAnUnsafeAction
The valid-diagnostic action is asserted first, then none for invalid metadata; only this delta was read.
Run /review-tests on a narrower scope for a full grade.
Uncertain
—
new CodeFixRegistrationContinuationTests.FixtureSignatureFixers_CannotFixMarker_SuppressesOnlyMarkedDiagnostics
It asserts one action unmarked and none for null/"true" markers; production body not traced.
Run /review-tests on a narrower scope for a full grade.
Uncertain
—
mod AnalyzerProcessCompatibilityTests.WaitForExit_ReleasedOrAlreadyExitedChild_PreservesTheExitCode
Waits are bounded via a 60s limit with a ready/release handshake; the rest was not graded.
Run /review-tests on a narrower scope for a full grade.
Uncertain
—
the other new and modified tests in the 30 files
Full per-test grading was not completed within budget.
Re-run /review-tests on a narrower scope.
No inline comments were published: no verified, actionable finding reached the publication gate. That is not an all-clear for the unread portions.
<sub>This advisory review is heuristic and non-blocking.
Re-run the combined review with /review-tests, or only the parallel-safety specialist with /parallel-audit.</sub>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The missing-framework tests leave disabled-by-default analyzers off, so their passing rows do not exercise the missing-symbol guards or detect regressions in them.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Enable disabled analyzers in missing-framework tests
The missing-framework matrix includes disabled-by-default analyzers such as PublicTypeShouldBeTestClassAnalyzer, but AnalyzeAsync leaves them disabled unless enableDisabledRules is set. Roslyn therefore skips those analyzers, so their rows pass without exercising the missing-symbol guards. For example, incorrectly registering the public-type analysis without a TestClassAttribute would still leave these rows green. Enable the rules here so the empty-diagnostics assertion actually protects that boundary.
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
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.
Pull request
Summary
Expand the safety net for previously uncovered MSTest analyzer and code-fix behavior: framework/signature boundaries, metadata-only attributes, stale diagnostics, full fixed-source output, custom fix-all, and linked Roslyn/compatibility helpers.
Production code, dependencies, coverage configuration/exclusions, and test scheduling are unchanged. This is progress toward, not a claim of, 100% coverage.
Design and decision record
This is a test-only change, so no separate feature design record is needed. It reuses the established source-built MSTest/Roslyn verifiers and per-test workspaces rather than changing shipping APIs, adding dependencies, or excluding difficult code from coverage.
Helper tests use real Roslyn symbols/operations, including the pinned implementation's parenthesized operation, without implementing reserved Roslyn interfaces. Process-lifetime checks own their child process and use a ready/release handshake with bounded cleanup. Existing expression-bodied-fixture and invalid/stale-input limitations are characterized, not repaired, in this PR.
Demonstration
N/A for screenshots: no product output or UI changes. The measured coverage and execution tables below provide the relevant text evidence.
Validation and regression proof
Validated source:
df9b675dd7b49b6bbd18775d013e05bc5af8a89aplus the test-only patch preserved unchanged in commit3fce8f9b306c19fdabeb710263dd2809233b4eaa. All 30 delivered C# files were checked against the tested SHA-256 snapshot and retain UTF-8 BOM.The pinned repository SDK was bootstrapped through the build scripts. The final clean Release build used the repository-local SDK, with no incremental compilation and warnings treated as errors: exit 0, 0 warnings, 0 errors.
Executed from the repository root (
$adenotes the task-owned local artifact directory):Each final unfiltered invocation exited 0 on Windows. The net472 host ran on .NET Framework 4.8.1. Method-level/CPU-count scheduling within each assembly was preserved.
This adds 726 discovered cases per target framework, across 207 new methods and 3 extended existing methods. The only skip is the unchanged Unix-only
MissingOutputPathWithInheritedCrashDumpSettingsDoesNotProduceDump, once per target.An earlier combined all-TFM invocation hit the pre-existing
GlobalConfigGeneratorContinuationTests.ConflictingDuplicateRuleFailsWithoutPartialConfigurationstemporary-DLL cleanupUnauthorizedAccessExceptionon net11.0 (also observed during the unchanged baseline). No new test failed in that run. It is retained as a validation limitation, not erased by the final clean, separate per-target invocations.TRX, CTRF and JUnit were parsed and reconciled for every target. Coverage exports used exactly the three successful final root
.coveragefiles, not failed runs or duplicate merged inputs:Both exports exited 0. Complete production image identities and denominators match the baseline; no exclusion, suppression, source deletion or denominator reduction was used.
For the directly comparable net10.0-only runs, touched-line coverage increased from 7764/8412 (92.30%) to 8382/8412 (99.64%) for analyzers and 2738/3068 (89.24%) to 3027/3068 (98.66%) for code fixes. The table above includes the union of all three targets.
Touched lines, native full/partial lines, and basic blocks are different metrics. The collector supplies no branch/condition denominator; its
branch-rate=1is not treated as measured 100% branch coverage. Remaining gaps include caller-invariant fallbacks, generated members, Release-elided DEBUG helpers and process-exit race paths; not every residual path is proved unreachable.Local binlogs, parsed result records, both coverage formats and complete residual inventories are retained in the session artifacts, not uploaded as inaccessible local-path links. The exact commands, counts and measurements are included here for reproduction; CI verification of the published head is pending. Package/acceptance, Debug, Linux and macOS runs were not performed for this test-only change.
Test-value evidence
These are safety-net/characterization additions on unchanged production behavior, not a product bug fix or new feature. The existing suite was green before implementation. Assertion sensitivity has been reviewed statically; no deliberate production mutation or empirical mutation-kill result is claimed.
The unchanged net10.0 baseline executed 2336 cases: 2335 passed, 0 failed, 1 pre-existing skip. Final execution is reported above; compiler/fixture-development failures are not counted as behavioral red-phase proof.
GenericArrayArguments_AllLegalElementTypes_AreInferredWithoutDiagnostic;DependencyTarget_UnresolvedType_DoesNotStackAnalyzerDiagnosticsOnTheErrorType;MetadataAttributes_DiagnosticsWithoutAttributeSyntax_FallBackToNoLocation.CancellationToken_OutOfOrderNamedArguments_AppendsANamedTokenWithoutReordering;CancellationToken_FixAll_SkipsStaleLocationAndAddsOnlyOneContextProperty;ConditionalAccess_FixAll_SkipsStaleDiagnosticAndSharesTheNullGuard.ParenthesizedOperations_PreserveParameterIdentityThroughBuiltInConversions;Combine_AllArities_MatchSeededXxHash32;WaitForExit_ReleasedOrAlreadyExitedChild_PreservesTheExitCode.