Skip to content

Revert return-value Assert.IsNotNull API - #12273

Merged
Amaury Levé (Evangelink) merged 3 commits into
mainfrom
dev/amauryleve/mstest-assertion-revert
Nov 9, 2026
Merged

Amaury Levé (Evangelink) merged 3 commits into
mainfrom
dev/amauryleve/mstest-assertion-revert

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Pull request

Summary

Reverts #12219 (3952da46db6823c1e64a6d1785e3a5edf77e4e85) and withdraws the return-value Assert.IsNotNull API. Relates to #10918; this does not implement the feature again.

Restore both void Assert.IsNotNull(object?, ...) overloads, including [NotNull] input flow, existing failure reporting, caller expressions, telemetry, lazy interpolated messages, and soft assertion scopes. Remove the feature's API/analyzer/return-value tests and decision document, plus its later unreleased changelog entry. Preserve unrelated changes on main and the independent consumer asset-path fix.

Four later MTP test guards now check object-valued arguments without discarding a result. Those projects still consume the published returning MSTest package; these calls compile with both that package and the restored void API without changing dependency versions.

Design and decision record

The withdrawal decision and rationale is the decision record for this rollback. A separate feature record is not appropriate for withdrawing the proposal.

The generic implementation synchronously returns the identical Task supplied as its argument. In an async method, an ordinary statement such as Assert.IsNotNull(_lazyTask); therefore produces CS4014; warnings-as-errors turns existing customer source into a build failure. Adding await changes the operation from a null check into waiting for that Task and can prevent shutdown cancellation from being reached. Keeping an object overload beside the returning generic overload would not fix overload selection.

The real downstream regression is documented in dotnet/sdk#56993 and its verified CI diagnosis. The SDK workaround is deliberately unchanged here and must remain until a corrected TestFx package flows.

This restores the synchronous library contract in the main/MSTest 5 preview line. It introduces no process handshake, fallback, reporter, or multi-module protocol change. No servicing branch, dependency rollout, issue-state change, merge, or automatic merge is part of this PR.

Demonstration

This is a nonvisual compiler/API contract; a text transcript is clearer than screenshots. The same package-consuming test executes before and after the revert:

Returning API, C# 12, Nullable=enable, TreatWarningsAsErrors=true:
Program.cs(16,9): error CS4014: Because this call is not awaited...
Outer assertion: Expected string to not contain the specified substring "CS4014".
2 executed, 2 failed, 0 skipped; outer exit 2.

Restored void API, same tests and six ordinary Task/Task<int> statements:
Build succeeded. 0 Warning(s), 0 Error(s).
<consumer>\bin\Release\<net10.0 or net11.0>\MSTest.TestFramework.dll
IsNotNull Task consumer passed.
2 executed, 2 passed, 0 skipped; child build/run and outer exit 0.

The child asserts that each checked Task is still incomplete, that cancellation has not occurred, and that successful interpolated messages were not evaluated. It then cancels shutdown, awaits the original Tasks, checks result 42, and verifies null rejection with all message forms.

Validation and regression proof

Verified revision: 0ae2812828093cad04e26ecadff4069de7ac25aa, parent 0ed1f874bf8afd75aec83ee4b7743d3f15cea2a2. Packages were built from that parent plus the committed source patch (SHA256 F2E44CD37FFD93E5F0FE372AB45D8885DD7D52B4E16DB71DA11CA46554320A05), not from an independently published preview. The unchanged baseline regression addition has patch SHA256 9405D57075944B1547D51B3D089DFAD4730E9B12F2E2DCC9475329CB5D549728.

Windows x64, Release, repository-pinned SDK 12.0.100-alpha.1.26509.101; framework/analyzer/MTP unit hosts ran on .NET 10. The acceptance host is built for .NET 12 and its real C#/F# consumers target .NET 10 and .NET 11. The task-owned worktree and per-test NuGet caches isolate the paired runs.

Requirement Evidence
Ordinary Task-valued assertions compile without discard/await and preserve nullable flow IsNotNullTaskStatements_CompileAndRunWithCSharp12 ("net10.0") and ("net11.0"): both child builds and executions passed against the restored package.
Null check finishes before cancellation/completion; lazy messages and null rejection remain correct The same two runtime consumer cases passed their pending-task, cancellation-order, message-evaluation, result, and exception assertions.
Existing nullable flow, failure/caller-expression text, lazy handlers, and soft scopes Seven AssertTests.*IsNotNull* cases passed, including Scope_AssertIsNotNull_IsSoftFailure.
Reverted analyzer/code-fix behavior Six WhenAssertIsNotNull* diagnostic/no-diagnostic cases and WhenAssertAreNotEqualAndExpectedIsNull passed.
Packed C# source shapes and F# callers remain valid Both PublicAssertCallShapes_CompileWithCSharp12 cases and four RunsNamedNestedExplicitAndCustomModulesAlongsideExistingClass cases passed (both TFMs, MTP and VSTest). The latter assert the six associated test names/outcomes.
Later MTP test guards compile and retain their cancellation/finalization behavior RunAsync_NestedMiddlewareFault_DelayedAncestorCancellationStillReachesLeafBeforeLinkedSourcesAreDisposed, ControllerIpc_UnsupportedRequestReachesFailFastAndRethrowsOriginal, three ShutdownServer_CancellationRegistration_UsesOnlyTheRemainingVirtualGrace rows, and LaunchInProcessAsync_CallbackIsCanceledBeforeConnecting_PreservesCancellationException: six passes.

Commands and results. All commands ran from the worktree root. $evidence is the task-owned log/artifact directory; $filter is its RevertValidation.slnf, selecting exactly TestFramework.UnitTests, MSTest.Analyzers.UnitTests, MSTest.Acceptance.IntegrationTests, Microsoft.Testing.Platform.UnitTests, and Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests. Build-script launches used invocation-local cmd.exe PATH setup for the installed Windows PowerShell; no repository or machine-wide setting was changed.

# Exit 0; zero warnings/errors. Repository build-script entrypoint and arguments:
.\eng\build.ps1 -installWindowsSdk -restore -build -c Release -msbuildEngine dotnet -projects $filter -bl -properties @('/p:SkipUapTargetFramework=true', "/bl:$evidence\focused-green-build-02-{}.binlog")

# Exit 0 each; actual owning shipping packages, after the successful build:
.\.dotnet\dotnet.exe pack src\Analyzers\MSTest.Analyzers.Package\MSTest.Analyzers.Package.csproj -c Release --no-build --no-restore -p:SkipUapTargetFramework=true "-bl:$evidence\green-analyzers-pack-{}.binlog"
.\.dotnet\dotnet.exe pack src\TestFramework\TestFramework.Extensions\TestFramework.Extensions.csproj -c Release --no-build --no-restore -p:SkipUapTargetFramework=true "-bl:$evidence\green-framework-pack-{}.binlog"

# Exit 0; 7 passes:
.\.dotnet\dotnet.exe test --project test\UnitTests\TestFramework.UnitTests\TestFramework.UnitTests.csproj -c Release -f net10.0 --no-build --treenode-filter '/*/*/AssertTests/*IsNotNull*' -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$results" "-bl:$evidence\framework-test-02-{}.binlog" --show-test-results all

# Exit 0; 7 passes:
.\.dotnet\dotnet.exe test --project test\UnitTests\MSTest.Analyzers.UnitTests\MSTest.Analyzers.UnitTests.csproj -c Release -f net10.0 --no-build --filter 'FullyQualifiedName~PreferAssertFailOverAlwaysFalseConditionsAnalyzerTests.WhenAssertIsNotNull|FullyQualifiedName~UseProperAssertMethodsAnalyzerTests.WhenAssertAreNotEqualAndExpectedIsNull' -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$results" "-bl:$evidence\analyzers-test-02-{}.binlog" --show-test-results all

# Exit 0; 8 passes, including the two retained regression cases:
.\.dotnet\dotnet.exe test --project test\IntegrationTests\MSTest.Acceptance.IntegrationTests\MSTest.Acceptance.IntegrationTests.csproj -c Release --no-build --filter 'FullyQualifiedName~AssertSourceCompatibilityTests|FullyQualifiedName~FSharpModuleTests.RunsNamedNestedExplicitAndCustomModulesAlongsideExistingClass' -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$results" "-bl:$evidence\acceptance-test-02-{}.binlog" --show-test-results all

# Exit 0; 2 passes:
.\.dotnet\dotnet.exe test --project test\UnitTests\Microsoft.Testing.Platform.UnitTests\Microsoft.Testing.Platform.UnitTests.csproj -c Release -f net10.0 --no-build --filter 'FullyQualifiedName~RunAsync_NestedMiddlewareFault_DelayedAncestorCancellationStillReachesLeafBeforeLinkedSourcesAreDisposed|FullyQualifiedName~ControllerIpc_UnsupportedRequestReachesFailFastAndRethrowsOriginal' -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$results" "-bl:$evidence\mtp-test-02-{}.binlog" --show-test-results all

# Exit 0; 4 passes:
.\.dotnet\dotnet.exe test --project test\UnitTests\Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests\Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests.csproj -c Release -f net10.0 --no-build --filter 'FullyQualifiedName~ShutdownServer_CancellationRegistration_UsesOnlyTheRemainingVirtualGrace|FullyQualifiedName~LaunchInProcessAsync_CallbackIsCanceledBeforeConnecting_PreservesCancellationException' -p:UsingDotNetTest=true "-p:ArtifactsTestResultsDir=$results" "-bl:$evidence\client-test-02-{}.binlog" --show-test-results all

Separate discovery used each same selector with --list-tests text, execution-only reporter properties blanked, and a unique discovery binlog: all discovery exits 0, counts 7/7/8/2/4. All five TRX files were checked with the repository's verify_execution.py against source/discovery-derived exact names, after the package timestamp and with process exit 0; all five gates passed. Their JUnit exports parsed with matching counts. The final retention of the existing spaced-asset build fix additionally passed both C# source-shape cases after a successful acceptance-project rebuild (exits 0).

Package provenance. MSTest.TestFramework.5.0.0-dev.nupkg SHA256 is 0E524C0C5189CD828E709D4D1C22E7DDEE0B756009DDA44EE01E711D1D5A379C; MSTest.Analyzers.5.0.0-dev.nupkg is 0CBE01829B2CFC260F334DC6A47BE3DE2E53E5B787725AC390E67B218B387837. Both consumers assert that their cached nupkg equals the current shipping nupkg. Their project.assets.json selects lib/net10.0 or lib/net11.0/MSTest.TestFramework.dll; the DLL printed by the running child matches that zip entry by SHA256 (FA1B53882B0DF9D656FCDC47EBC974AC9E3566057F5F9EEB6AEB857082B7CCB0 / EB05F8502DF5334A9F9A31A4417D047A02B590172CCECE93F063922DE9D25CD0).

Limits. The first full Windows pack attempt compiled and produced the returning baseline packages but its package-content verifier exited 1 because SkipUapTargetFramework=true intentionally omitted legacy UAP assets (MSTest 10/9, adapter 66/64, framework 105/88, expected/actual). That is not claimed as a green full-Windows-layout result; the subsequent owning-project packs and .NET consumers passed. Non-Windows runs, legacy UAP activation/full layout, .NET Framework test execution, and CI for this PR head are not claimed. No downstream corrected-package flow is claimed.

Test-value evidence

Contract / test case Counterfactual Without fix Correct implementation Evidence / gap
C# 12 Task/Task statements / both IsNotNullTaskStatements_CompileAndRunWithCSharp12 cases Actual returning API on parent 0ed1f874bf8afd75aec83ee4b7743d3f15cea2a2, same regression addition retained Executed: detected. Both outer tests executed and failed at Assert.DoesNotContain("CS4014", output); successful child restore then six CS4014 diagnostics per consumer; outer exit 2, 2 failed, no skips. Executed: passed. Same two cases/assertions; both child builds/runs and outer exit 0, no warnings/skips. Returning nupkg SHA256 D045AC0EF37AFD52C008CC5E05763B0E2ACB98A73C41ADA1EA6C5CED21972BC2; restored hash above. This is an asserted compiler contract, not an outer setup/compilation failure.
Previous null-assertion behavior and coupled test guards Preserve existing behavior while restoring void signatures / cross-version object-valued test checks Existing behavior is not intentionally removed; no artificial fault result claimed. Seven framework and six coupled MTP/client cases passed; analyzer and packaged-language compatibility cases also passed. Focused preservation evidence, not an exhaustive mutation or platform matrix.

The red run used the same regression-only selector via dotnet test --project test\IntegrationTests\MSTest.Acceptance.IntegrationTests\MSTest.Acceptance.IntegrationTests.csproj -c Release --no-build --filter 'FullyQualifiedName~AssertSourceCompatibilityTests.IsNotNullTaskStatements_CompileAndRunWithCSharp12' -p:UsingDotNetTest=true, with its own results directory/binlog and isolated caches. Red/green TRX, JUnit, binlogs, source patches, nupkgs, and consumer provenance are retained in task artifacts; the decisive results and hashes are reproduced here rather than relying on inaccessible local paths.

Revert commit 3952da4, restore the void null assertions, and cover Task-valued async consumers. Preserve later main changes and make pinned-package MTP test guards work with both API versions.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 11:40
@github-actions github-actions Bot added the state/needs-review Awaiting review from the team. label Nov 9, 2026

@github-actions github-actions Bot 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.

🤖 Reviewed by Copilot — workflow run.

Summary: This PR reverts the generic Assert.IsNotNull<T> change (#12219). It restores the two void IsNotNull(object?, ...) overloads, the PublicAPI.Unshipped.txt entries, the MSTEST0037 fixer, the F# |> ignore calls and the related tests. It also removes the decision record and changelog entry. It adds a Task-statement consumer test, which checks that statement-form calls on Task don't raise CS4014.

Review result: No blocking correctness issues found. The restored API surface is internally consistent with PublicAPI.Unshipped.txt, and the tests that relied on the return value were removed or updated. I found no remaining references to the generic overload in docs/ apart from the RFCs, which describe the original void design.

Findings (inline, non-blocking):

  • AssertSourceCompatibilityTests: a failed build now surfaces as FileNotFoundException instead of the build output.
  • Several test projects keep an (object?) cast plus a comment about "both API versions" that looks stale after the revert.

Dependency assessment: No dependency changes.

Test-value evidence: Not executed. I did not run or mutate the PR code, so this is a static assessment only. The new Task-consumer test would fail if the change reintroduced CS4014 on Task statement calls, but I have no executed red/green proof for this revision.

Specialist summaries: I reviewed the diff directly; no specialist agents were used.

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026

@github-actions github-actions Bot 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.

🧪 Test quality review — PR #12273

Compared merge base 0ed1f874bf8afd75aec83ee4b7743d3f15cea2a2 with head 0ae2812828093cad04e26ecadff4069de7ac25aa. Evidence applies to this head, not every intermediate commit.

Test-value evidence

Contract Test / data case Counterfactual Result
Assert.IsNotNull is void, so ordinary Task statements compile under C# 12 without CS4014 AssertSourceCompatibilityTests.IsNotNullTaskStatements_CompileAndRunWithCSharp12 (net10.0 and net11.0), retained from the parent The returning generic overload, which is the parent API Static prediction: detected, because the child build would emit CS4014 and trip Assert.DoesNotContain("CS4014", output). The PR description reports an executed red/green run, but I could not verify those records from here.
IsNotNull(object?) nullable flow, failure text, lazy interpolated handler and soft-scope behavior AssertTests.IsNotNull_* and Scope_AssertIsNotNull_IsSoftFailure A wrong or removed null check or [NotNull] annotation Static prediction: protected. The failure-message assertions are exact, and the nullable flow is checked by obj.ToString() compiling without a warning.
Analyzer and code fix: IsNotNull<object>(null) becomes IsNotNull(null), and the fixer no longer preserves the type argument PreferAssertFailOver...WhenAssertIsNotNull* and the existing WhenAssertAreNotEqualAndExpectedIsNull The fixer emitting a generic name Static prediction: protected. The removed tests covered only the withdrawn generic and return-value behavior.
Withdrawn return-value API: the tests, decision doc and PublicAPI entries are removed None needed None Not applicable. The removal is intended.
Changelog and docs None None Not applicable. These are non-executable changes.

Evidence gap: this workflow does not execute code. The PR's red/green runs are author-reported, and no accessible run records were checked against these revisions.

🧵 Parallel safety

STATUS: NOT_APPLICABLE (not delegated). The diff changes only call shapes, removes tests, and edits no parallelization configuration, lifecycle methods or shared assets. It adds no new shared state. Treat this as not assessed by the specialist.

Per-test assessment

Pseudo-mutation evidence below consists of static predictions, not executed mutation results.

Result Quality Test Notes How to improve
Pass A (90–100) mod AssertTests.IsNotNull_PassNull_ShouldFail An exact multiline failure message is asserted. None
Pass A (90–100) mod AssertTests.IsNotNull_StringMessage_PassNonNull_ShouldFail An exact failure message includes the user text. None
Pass A (90–100) mod AssertTests.IsNotNull_InterpolatedString_PassNonNull_ShouldFail An exact message is asserted for the interpolated handler. None
Pass B (80–89) mod AssertTests.IsNotNull_WhenNonNullNullableValue_DoesNotThrowAndLearnNotNull Nullable flow is checked at compile time and no throw is asserted. None
Pass B (80–89) mod AssertTests.IsNotNull_WhenNonNullNullableValueAndMessage_DoesNotThrowAndLearnNotNull Same contract with a string message. None
Pass A (90–100) mod AssertTests.IsNotNull_WhenNonNullNullableValueAndInterpolatedStringMessage_DoesNotThrowAndLearnNotNull Lazy message evaluation is asserted. None
Pass A (90–100) mod AssertTests.Scope_AssertIsNotNull_IsSoftFailure A soft failure is collected inside the scope. None
Pass B (80–89) mod AssertSourceCompatibilityTests.IsNotNullTaskStatements_CompileAndRunWithCSharp12 An end-to-end compile and runtime consumer is asserted. None
Pass B (80–89) mod PreferAssertFailOverAlwaysFalseConditionsAnalyzerTests.WhenAssertIsNotNull* Diagnostic and fixed output are verified for the non-generic form. None

The other changed files (FSharpModuleTests, MtpServerClientInProcessTests, TestHostControllersTestHostFinalizationTests, TestHostExecutionOrchestratorMiddlewarePipelineTests) only drop the use of a return value. The grading for those rows is abbreviated and I did not grade them individually.

No inline findings were published.

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.

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto · ~32 AIC · ⌖ ~1 AIC · ⊞ 8K

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The fixer generates a noncompiling Assert.IsNotNull([]) call because it loses the collection expression’s int[] target type, and the deleted regression case needs to be restored.

1 open issue
What changed in this PR

Withdraws the return-value Assert.IsNotNull API from MSTest 5 preview, restoring synchronous void assertions to avoid CS4014 warnings for ordinary Task-valued calls.

Changes:

  • Restores both object-based overloads and their API tracking.
  • Removes return-value-specific tests and documentation, and updates affected C# and F# callers.
  • Adds packed C# 12 consumer coverage for Task assertions, nullable flow, lazy messages, and cancellation ordering.

Test-value evidence: The PR reports two regression cases failing before the rollback and passing at revision 0ae2812828093cad04e26ecadff4069de7ac25aa. Static inspection supports the intended compiler-contract check; execution artifacts were not independently verified, and no builds or tests were run during this review.

File Description
test/​UnitTests/​TestFramework.UnitTests/​Assertions/​AssertTests.ScopeTests.cs Adapts soft-scope coverage to void assertions.
test/​UnitTests/​TestFramework.UnitTests/​Assertions/​AssertTests.IsNull.cs Restores void call forms and removes return-value cases.
test/​UnitTests/​MSTest.Analyzers.UnitTests/​UseProperAssertMethodsAnalyzerTests.cs Removes generic-target code-fix cases.
test/​UnitTests/​MSTest.Analyzers.UnitTests/​PreferAssertFailOverAlwaysFalseConditionsAnalyzerTests.cs Restores nongeneric calls and removes result-use cases.
test/​UnitTests/​Microsoft.Testing.Platform.UnitTests/​TestHostExecutionOrchestratorMiddlewarePipelineTests.cs Uses an object-valued null check compatible with both APIs.
test/​UnitTests/​Microsoft.Testing.Platform.UnitTests/​Hosts/​TestHostControllersTestHostFinalizationTests.cs Updates the peer-task null check for both APIs.
test/​UnitTests/​Microsoft.Testing.Platform.ServerMode.Client.Sources.UnitTests/​MtpServerClientInProcessTests.cs Updates two task guards for cross-version compatibility.
test/​IntegrationTests/​MSTest.Acceptance.IntegrationTests/​FSharpModuleTests.cs Removes unnecessary result ignores.
test/​IntegrationTests/​MSTest.Acceptance.IntegrationTests/​AssertSourceCompatibilityTests.cs Adds packed Task-consumer regression coverage and removes returning-API cases.
src/​TestFramework/​TestFramework/​PublicAPI/​PublicAPI.Unshipped.txt Reverts the return-value API declarations and void removals.
src/​TestFramework/​TestFramework/​Assertions/​Assert.IsNull.cs Restores both void IsNotNull overloads.
src/​Analyzers/​MSTest.Analyzers.CodeFixes/​UseProperAssertMethodsFixer.cs Removes generic type-argument preservation.
docs/​decisions/​assert-isnotnull-return-value.md Removes the withdrawn feature’s decision record.
docs/​Changelog.md Removes the unreleased return-value API announcement.

Review effort: Balanced

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026
@github-actions github-actions Bot removed the state/needs-review Awaiting review from the team. label Nov 9, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. state/approved Proposal approved; ready for implementation. labels Nov 9, 2026
@github-actions

This comment has been minimized.

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Nov 9, 2026
@github-actions github-actions Bot removed state/needs-review Awaiting review from the team. state/approved Proposal approved; ready for implementation. labels Nov 9, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the state/needs-review Awaiting review from the team. label Nov 9, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. state/approved Proposal approved; ready for implementation. labels Nov 9, 2026
@github-actions

This comment has been minimized.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the state/needs-review Awaiting review from the team. label Nov 9, 2026
@github-actions github-actions Bot added state/approved Proposal approved; ready for implementation. and removed state/needs-review Awaiting review from the team. state/approved Proposal approved; ready for implementation. labels Nov 9, 2026
Keep both inferred and explicit-generic AreNotEqual inputs, but require nongeneric IsNotNull output and retain the generated-source compilation check. Both inputs and the four collection-expression regression cases pass on net10.0, net11.0, and net472.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 15:06

@github-actions github-actions Bot 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.

🧪 Test quality review — PR #12273

Compared merge base 0ed1f874bf8afd75aec83ee4b7743d3f15cea2a2 with head ed362d1cfc4a4852f6eb46edae302ad8a8a8c7ca. Evidence applies to this head, not every intermediate commit.

Test-value evidence

All entries are static predictions; no paired execution records were available.

Contract Test / data case Counterfactual Result
Assert.IsNotNull reverts to the non-generic void overloads (value and interpolated-handler) AssertTests.IsNull IsNotNull_* tests, Scope_AssertIsNotNull_IsSoftFailure Restoring the generic return overload would break the non-generic call shapes and the nullable flow-state checks (_ = obj.ToString()). Static prediction: detected
Code fix no longer preserves a generic type argument; it casts collection-expression actuals to the parameter type WhenAssertAreNotEqualAndExpectedIsNull_PreservesCollectionExpressionTargetType (4 data rows: plain, populated, parenthesized, conditional) Removing the new CollectionExpressionSyntax cast branch would leave an untyped [] argument, which does not compile. Static prediction: detected
Public API unshipped entries and docs removed Not executable n/a Not applicable
Assert source-compatibility call shapes and F# module tests updated AssertSourceCompatibilityTests, FSharpModuleTests Not traced in detail. Unverified

🧵 Parallel safety

STATUS: PARTIAL. The specialist task was not run in this session, so parallel-safety coverage is incomplete. This is not a clean result. The changed tests are assertion and analyzer tests, and no parallelization configuration files changed (config_count=0).

Per-test assessment

Per-test grading was limited to a static read of the diff. The changes are mostly deletions of return-value tests and mechanical call-site updates. Pseudo-mutation evidence was not produced.

Result Quality Test Notes How to improve
Pass — mod AssertTests.IsNotNull_WhenNonNullNullableValue_DoesNotThrowAndLearnNotNull The test still checks nullable flow analysis. None
Pass — mod AssertTests.IsNotNull_PassNull_ShouldFail An exact failure message is asserted. None
Pass — mod AssertTests.Scope_AssertIsNotNull_IsSoftFailure The test still asserts both collected failures. None
Pass — mod UseProperAssertMethodsAnalyzerTests.WhenAssertAreNotEqualAndExpectedIsNull_PreservesCollectionExpressionTargetType Four collection-expression shapes assert exact fixed code. None

No inline findings were published. Deduplication against existing threads was not completed, so none were attempted.

<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>

🤖 Automated content by GitHub Copilot. Generated by the Test Quality Review on PR (on open / sync) workflow. · copilot · auto · ~28 AIC · ⌖ ~1 AIC · ⊞ 8K

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The fixer still drops contextual types for target-typed constructors and lambdas, producing non-compiling code and requiring broader type preservation with regression coverage.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve contextual types for constructors and lambdas

src/​Analyzers/​MSTest.Analyzers.CodeFixes/​UseProperAssertMethodsFixer.cs:358

The collection-only guard still loses contextual types for target-typed constructors and lambdas: Assert.AreNotEqual<Exception>(null, new("message")) becomes Assert.IsNotNull(new("message")), which attempts to call a nonexistent object(string) constructor. Likewise, Assert.AreNotEqual<Func<int, int>>(null, x => x) loses the lambda's parameter type and no longer compiles. Extend the cast condition to preserve these arguments' original contextual types, and add compiling regression cases alongside the collection-expression cases.

Review effort: Balanced

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Final test-triage resolution — Azure Pipelines build 1671086

Resolution: inconclusive, but a likely PR-related test failure was identified. No issue created.

Affected leg: Windows Debug, step "Test (unit tests only)". It failed with exit code 2.

Failure signature (net472 only):

  • AnalyzerWaitForRunningProcess [net472] and CodeFixWaitForRunningProcess [net472] both fail at test/UnitTests/MSTest.Analyzers.UnitTests/Helpers/AnalyzerProcessCompatibilityTests.cs:41.
  • The failing assertion is Assert.IsFalse(waiting.IsCompleted). It expected false but got true: the wait had already completed when the test expected it to still be blocked.
  • The collected reports also show a failed CodeFixWaitCancellation result on net472.
  • The same tests passed on net10.0 and net11.0 in the same leg, so the failure looks specific to the .NET Framework run.

Assessment (confidence: medium):

  • This looks like a deterministic or timing-sensitive defect in the process-wait test helper or the code under test on net472, not an infrastructure problem. I did not confirm the root cause.
  • No crash or hang diagnostics were collected, and no binary dumps were inspected.
  • The history window is incomplete (artifact-download-failed, download-budget-exhausted), and 2 artifact downloads failed. I therefore cannot say whether this signature appeared on main or in earlier builds. I also cannot call the tests clean.
  • No slowness regressions were detected.
  • I found no existing open or closed issue matching these tests.

Next step: Check how waiting.IsCompleted is expected to behave on .NET Framework in AnalyzerProcessCompatibilityTests (line 41), and re-run the Windows Debug leg to see whether the failure repeats. If it does not repeat, that points to a race. If it recurs on main or in unrelated commits, it would qualify for a durable issue.

🤖 Automated content by GitHub Copilot. Generated by the Pipeline Test Triage workflow. · copilot · auto · ~28 AIC · ⌖ ~1 AIC · ⊞ 10K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants