Skip to content

Fix flaky TestWindowStyle: check only STARTF_USESHOWWINDOW bit, remove ShellExecute cases#125847

Merged
adamsitnik merged 2 commits intomainfrom
copilot/fix-processstartinfo-tests
Mar 21, 2026
Merged

Fix flaky TestWindowStyle: check only STARTF_USESHOWWINDOW bit, remove ShellExecute cases#125847
adamsitnik merged 2 commits intomainfrom
copilot/fix-processstartinfo-tests

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

Description

ProcessStartInfoTests.TestWindowStyle was flaky in CI due to two issues:

  1. Exact dwFlags assertion — the test compared the full dwFlags value, but the OS can set additional bits beyond STARTF_USESHOWWINDOW (0x1), causing spurious failures.
  2. ShellExecute test cases — half the test matrix (useShellExecute: true) tested OS ShellExecute implementation behavior, which is not our responsibility to verify and was the primary source of timeouts.

Changes

  • Check only the STARTF_USESHOWWINDOW bit (si.dwFlags & 0x1) instead of the exact dwFlags value
  • Remove useShellExecute parameter and all [InlineData(..., true/false)] entries (8 → 4 test cases)
  • Remove Mono ShellExecute skip logic (SkipTestException) and unused using Microsoft.DotNet.XUnitExtensions
- Assert.Equal(expectedDwFlag, si.dwFlags);
+ Assert.Equal(expectUsesShowWindow, (si.dwFlags & 0x1) != 0); // STARTF_USESHOWWINDOW is 0x1
Original prompt

This section details on the original issue you should resolve

<issue_title>System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle failing in CI</issue_title>
<issue_description>## Build Information
Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1144025
Build error leg or test failing: System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle
Pull request: #119528

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": ["System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle", "Assert.True() Failure", "Expected: True"],
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1144025
Error message validated: [System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle Assert.True() Failure Expected: True]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 9/10/2025 12:16:36 PM UTC

Report

Build Definition Test Pull Request
1344644 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle #124544
1344588 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle #125821
1344101 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle
1342209 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle #125758
1341738 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle #124770
1341721 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle #125742
1341628 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle
1340451 dotnet/runtime System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle #125706
1338820 dotnet/runtime System.Diagnostics.Process.Tests.WorkItemExecution #125643
1338310 dotnet/runtime [System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle](https://dev.azure.com/dnceng-public/public/_build/resu...

⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process
See info in area-owners.md if you want to be subscribed.

…TARTF_USESHOWWINDOW bit

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle failure in CI Fix flaky TestWindowStyle: check only STARTF_USESHOWWINDOW bit, remove ShellExecute cases Mar 20, 2026
Copilot AI requested a review from adamsitnik March 20, 2026 17:38
@adamsitnik adamsitnik marked this pull request as ready for review March 20, 2026 17:59
Copilot AI review requested due to automatic review settings March 20, 2026 18:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR stabilizes ProcessStartInfoTests.TestWindowStyle on Windows by narrowing the assertion to the STARTF_USESHOWWINDOW bit and removing UseShellExecute-driven cases that exercised OS ShellExecute behavior (and caused CI timeouts).

Changes:

  • Update the test to assert only whether STARTF_USESHOWWINDOW is set (dwFlags & 0x1) rather than comparing the entire dwFlags value.
  • Remove the useShellExecute dimension from the theory data (8 cases → 4 cases).
  • Remove Mono-specific ShellExecute skip logic and the now-unused Microsoft.DotNet.XUnitExtensions using.

@adamsitnik adamsitnik enabled auto-merge (squash) March 20, 2026 19:14
@adamsitnik adamsitnik requested a review from danmoseley March 20, 2026 19:15
@adamsitnik
Copy link
Member

/ba-g wasm timeout is unrelated

@adamsitnik adamsitnik merged commit 814f1ae into main Mar 21, 2026
88 of 90 checks passed
@adamsitnik adamsitnik deleted the copilot/fix-processstartinfo-tests branch March 21, 2026 08:04
@adamsitnik adamsitnik added this to the 11.0.0 milestone Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle failing in CI

4 participants