Add unit test branch coverage for CrashDumpProcessLifetimeHandler - #11087
Conversation
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The diff does not implement any of the CrashDump tests or behavior described by the PR metadata.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 26/26 changed files
- Comments generated: 1
- Review effort level: Balanced
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The HangDump test races through process-global state, and unrelated localization changes should be removed or separated.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
src/Analyzers/MSTest.Analyzers/xlf/Resources.zh-Hant.xlf:766
- These analyzer localization entries (and the matching changes in the other 25 analyzer/code-fix XLF files) are unrelated to the stated CrashDump test-coverage change, and neither source
.resxfile is changed by this PR. Please remove the unrelated generated XLF changes or move the localization synchronization to a dedicated PR so this change remains reviewable and scoped to #11047.
<trans-unit id="OSPlatformAttributesShouldBeConsistentDescription">
<source>'SupportedOSPlatformAttribute' and 'UnsupportedOSPlatformAttribute' inform platform compatibility analysis but do not control MSTest execution. Test methods and test classes that use these attributes should also declare an equivalent '[OSCondition]' so unsupported tests are skipped at run time.</source>
<target state="new">'SupportedOSPlatformAttribute' and 'UnsupportedOSPlatformAttribute' inform platform compatibility analysis but do not control MSTest execution. Test methods and test classes that use these attributes should also declare an equivalent '[OSCondition]' so unsupported tests are skipped at run time.</target>
<note>{Locked="'SupportedOSPlatformAttribute'"}{Locked="'UnsupportedOSPlatformAttribute'"}{Locked="MSTest"}{Locked="'[OSCondition]'"}</note>
- Files reviewed: 27/27 changed files
- Comments generated: 1
- Review effort level: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The HangDump test introduces a parallel shared-state race, and most added scenarios duplicate existing coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (5)
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs:1057
- The existing
BeforeTestHostProcessStartAsync_StrictCrashReportIsSet_DoesNotDisplayUnsupportedMessagetest at lines 426–443 already verifies this exact option combination and outcome. Remove this duplicate test rather than maintaining the same scenario twice.
[TestMethod]
public async Task BeforeTestHostProcessStartAsync_WhenBothCrashReportAndIfSupportedSet_EmitsNoMessage()
{
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs:1077
- This platform-split test duplicates
BeforeTestHostProcessStartAsync_CrashReportIfSupported_DisplaysUnsupportedMessageOnceat lines 396–424, which already calls twice and verifies both the Windows/.NET Framework message and the non-Windows no-op. Remove the redundant Windows and non-Windows variants.
[TestMethod]
[OSCondition(ConditionMode.Include, OperatingSystems.Windows, IgnoreMessage = "Informational message is only emitted on Windows where crash reports are unsupported.")]
public async Task BeforeTestHostProcessStartAsync_WhenIfSupportedSetOnWindows_EmitsMessageExactlyOnce()
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs:1123
- The disabled, graceful-exit, and HangDump-exit scenarios added here duplicate the existing tests at lines 445–531. Remove these duplicate methods so each branch has one authoritative test and fixture setup.
[TestMethod]
public async Task OnTestHostProcessExitedAsync_WhenCrashHandlingIsNotEffective_ReturnsWithoutPublishingOrDeletingSequenceFile()
{
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs:1202
- This test mutates process-wide
AppDomainstate while the assembly enables method-level parallelization (Program.cs:11). Unlike the existing equivalent test at lines 500–531, it is not marked[DoNotParallelize]and resets the key tonullrather than restoring its prior value, so concurrent exit tests can be forced down the HangDump branch. Remove the duplicate, or add isolation and preserve/restore the original value.
public async Task OnTestHostProcessExitedAsync_WhenProcessKilledByHangDump_DeletesSequenceFileAndDoesNotPublish()
{
string tempDir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "crashdump-tests-" + Guid.NewGuid().ToString("N"))).FullName;
try
{
AppDomain.CurrentDomain.SetData("ProcessKilledByHangDump", "true");
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CrashDumpTests.cs:1241
OnTestHostProcessExitedAsync_PreCancelledToken_ThrowsBeforeHandlingExitat lines 533–562 already verifies this exception and additionally proves cancellation happens before sequence-file deletion or publishing. Remove this weaker duplicate test.
[TestMethod]
public async Task OnTestHostProcessExitedAsync_WhenCancellationRequested_ThrowsOperationCanceledException()
{
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
This comment has been minimized.
This comment has been minimized.
🧪 Expert test review — PR #11087
Note: three additional high-confidence findings on these same tests (a missing This advisory comment was generated automatically. Grades are heuristic
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove test scenarios duplicated by the latest main branch while retaining the unique guard-clause and metadata coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
🧪 Expert test review — PR #11087
Both new tests target This advisory comment was generated automatically. Grades are heuristic
|
There was a problem hiding this comment.
🤖 Automated content by GitHub Copilot. Generated by the Test Reviewer on PR (on open / sync) workflow. · auto · 96.5 AIC · ⌖ 2.61 AIC · ⊞ 17K · ◷
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
🧵 Parallel-safety audit — PR #11087Nothing audited here touches process-global state, shared filesystem paths, or Audited Re-run with
|
🧪 Expert test review — PR #11087Reviewed the two test methods newly added in the diff (lines 977-1009 of
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
|
|
Final resolution for Azure Pipelines build [1586701]((dev.azure.com/redacted) ( No test-product failures, retries, or flaky results were found. All 91,060 normalized test records (CTRF/TRX/JUnit) across the matrix report The build's overall No durable issue threshold is met: this is a single-run infrastructure timeout isolated to this PR's build, with no evidence of a recurring or code-level defect. Next step: if the Linux Release leg times out again on a rebuild, it may indicate a worker/agent capacity or hang issue worth escalating to pipeline infrastructure owners; re-run the PR build to confirm.
|
CrashDumpProcessLifetimeHandlerlacked unit tests for its enablement gating,--crash-report-if-supportedinformational message deduplication, and early-exit branches for graceful or HangDump-killed test host processes.Changes
IsEnabledAsync): Added tests verifying the three-way CLI option check (--crash-dump,--crash-report,--crash-report-if-supported) combined withCrashDumpConfiguration.Enable.BeforeTestHostProcessStartAsync):Interlocked.Exchangeguard on Windows/.NET Framework when--crash-report-if-supportedis passed.--crash-reportis also present.OnTestHostProcessExitedAsync):hasExitedGracefully: trueor whenAppDomain.CurrentDomain.GetData("ProcessKilledByHangDump") == "true".Uid,DisplayName,Description, andVersionproperties.CapturingOutputDeviceto captureTextOutputDeviceDatain addition to error messages.--crash-report-if-supportedno-op path, and graceful/HangDump exit branche [Content truncated due to length] #11047