Skip to content

Fix foreground shutdown test - #131437

Open
eduardo-vp wants to merge 1 commit into
dotnet:mainfrom
eduardo-vp:fix-131403-foreground-shutdown
Open

Fix foreground shutdown test#131437
eduardo-vp wants to merge 1 commit into
dotnet:mainfrom
eduardo-vp:fix-131403-foreground-shutdown

Conversation

@eduardo-vp

@eduardo-vp eduardo-vp commented Jul 27, 2026

Copy link
Copy Markdown
Member

We had a race between the xunit wrapper and the foreground thread (which thread sets the exit code) which is easier to trigger under JIT stress. Adding one more second to Thread.Sleep and removing the wrapper should be enough to make this test pass even with JIT stress I think.

Fixes #131403.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @VSadov
See info in area-owners.md if you want to be subscribed.

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.

Pull request overview

This PR updates a CoreCLR regression test under src/tests to avoid relying on the xUnit wrapper-generated entrypoint, so the test’s exit-code behavior is driven solely by the test’s own Main/foreground thread logic (reducing race-induced flakiness under stress).

Changes:

  • Disable the xUnit wrapper generator for the test project and remove the TestLibrary project reference.
  • Replace the xUnit [Fact] entrypoint with a custom Main method.
  • Increase the worker thread delay to widen the window for validating shutdown/exit-code behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/tests/baseservices/threading/regressions/2164/foreground-shutdown.csproj Disables wrapper generation and removes TestLibrary reference to run as a custom-Main process-isolated test.
src/tests/baseservices/threading/regressions/2164/foreground-shutdown.cs Switches to Main and adjusts the sleep interval before Environment.Exit(100) for more stable behavior.

@eduardo-vp

Copy link
Copy Markdown
Member Author

/azp list

@azure-pipelines

Copy link
Copy Markdown
CI/CD Pipelines for this repository:

@eduardo-vp

Copy link
Copy Markdown
Member Author

/azp run runtime-coreclr jitstressregs

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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.

Test failure: baseservices/threading/regressions/2164/foreground-shutdown/foreground-shutdown.cmd

2 participants