Skip to content

Make IsAlive test reliable and re-enable it for crossgen2#117987

Merged
kg merged 2 commits intodotnet:mainfrom
kg:issue109312
Jul 24, 2025
Merged

Make IsAlive test reliable and re-enable it for crossgen2#117987
kg merged 2 commits intodotnet:mainfrom
kg:issue109312

Conversation

@kg
Copy link
Copy Markdown
Member

@kg kg commented Jul 23, 2025

Fixes issue #109312

For me the old version of this test fails locally even without R2R involved.

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 23, 2025
@kg
Copy link
Copy Markdown
Member Author

kg commented Jul 23, 2025

/azp run runtime-coreclr crossgen2 outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@kg kg added area-GC-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jul 23, 2025
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

@kg kg marked this pull request as ready for review July 23, 2025 19:51
Copilot AI review requested due to automatic review settings July 23, 2025 19:51
Copy link
Copy Markdown
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 fixes a flaky test that was unreliable and re-enables it for crossgen2 testing. The test verifies WeakReference.IsAlive behavior by ensuring proper timing of object collection.

Key changes:

  • Moves WeakReference creation into the array creation method to prevent dangling references
  • Improves test logic to properly validate expected behavior
  • Re-enables the test by removing it from the crossgen2 exclusion list

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/tests/issues.targets Removes exclusion entry to re-enable the IsAlive test for crossgen2
src/tests/GC/API/WeakReference/IsAlive.cs Refactors test logic to create WeakReference in CreateArray method and improves validation

Comment thread src/tests/GC/API/WeakReference/IsAlive.cs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@kg kg merged commit 45f7fc4 into dotnet:main Jul 24, 2025
75 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants