Skip to content

Fix SkipOnCoreClr generating unreachable test code in standalone runner#126517

Merged
MichalStrehovsky merged 4 commits intodotnet:mainfrom
MichalStrehovsky:skiponcoreclr
Apr 8, 2026
Merged

Fix SkipOnCoreClr generating unreachable test code in standalone runner#126517
MichalStrehovsky merged 4 commits intodotnet:mainfrom
MichalStrehovsky:skiponcoreclr

Conversation

@MichalStrehovsky
Copy link
Copy Markdown
Member

Noticed this when my agent started marking ActiveIssue'd native AOT tests as working. The tests clearly shouldn't pass but they did. See #126499 that makes a test fail and we get a green CI without this commit (and fail with this commit).

SkipOnCoreClrAttribute handling in XUnitWrapperGenerator initialized skippedTestPlatforms, skippedConfigurations, and skippedTestModes to their respective .Any values. When the attribute only specified one dimension (e.g., RuntimeTestModes.InterpreterActive), the others remained at Any. This caused DecorateWithSkipOnCoreClrConfiguration to compute targetPlatform & ~Any = 0, which produced a literal (false) platform condition, making the test body unreachable dead code. The standalone runner would return 100 (pass) without ever executing the test.

Fix by initializing the defaults to 0 (meaning 'not specified'), and updating the 'no args given' check accordingly. Now unspecified dimensions correctly mean 'don't skip'.

SkipOnCoreClrAttribute handling in XUnitWrapperGenerator initialized
skippedTestPlatforms, skippedConfigurations, and skippedTestModes to
their respective .Any values. When the attribute only specified one
dimension (e.g., RuntimeTestModes.InterpreterActive), the others
remained at Any. This caused DecorateWithSkipOnCoreClrConfiguration to
compute targetPlatform & ~Any = 0, which produced a literal (false)
platform condition, making the test body unreachable dead code. The
standalone runner would return 100 (pass) without ever executing the
test.

Fix by initializing the defaults to 0 (meaning 'not specified'), and
updating the 'no args given' check accordingly. Now unspecified
dimensions correctly mean 'don't skip'.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MichalStrehovsky
Copy link
Copy Markdown
Member Author

/azp run runtime-nativeaot-outerloop, runtime-coreclr outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

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

Fixes SkipOnCoreClrAttribute handling in the XUnit wrapper source generator so that specifying only one skip “dimension” (e.g., RuntimeTestModes.InterpreterActive) no longer results in a false platform condition that makes the generated test body unreachable in the standalone runner.

Changes:

  • Initialize skippedTestPlatforms, skippedConfigurations, and skippedTestModes to 0 (meaning “unspecified”) instead of Any.
  • Update the “no args given” check to detect the new 0-initialized state and preserve the intended “skip all CoreCLR” behavior only when no dimensions are provided.

Copilot AI review requested due to automatic review settings April 6, 2026 04:30
@MichalStrehovsky
Copy link
Copy Markdown
Member Author

/azp run runtime-nativeaot-outerloop, runtime-coreclr outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

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

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

@MichalStrehovsky
Copy link
Copy Markdown
Member Author

/azp run runtime-nativeaot-outerloop, runtime-coreclr outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@MichalStrehovsky
Copy link
Copy Markdown
Member Author

/azp run runtime-nativeaot-outerloop, runtime-coreclr outerloop

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@MichalStrehovsky
Copy link
Copy Markdown
Member Author

/ba-g failure building DNNE that looks like an infra hiccup, networking test, and #122345, all unrelated

@MichalStrehovsky MichalStrehovsky merged commit 2740c3d into dotnet:main Apr 8, 2026
159 of 164 checks passed
@MichalStrehovsky
Copy link
Copy Markdown
Member Author

/ba-g failure building DNNE that looks like an infra hiccup, networking test, and #122345, all unrelated

Oh, okay, the DNNE issue is not an infra hiccup, here it is in some jitstress run too. Not sure why we're not seeing this more widely:

https://github.com/dotnet/runtime/runs/70515032230

Logged #126673

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants