Skip to content

Fix Mono detection in TestPlatformHelper - #66483

Merged
wtgodbe merged 3 commits into
dotnet:mainfrom
medhatiwari:fixdetection
Jun 24, 2026
Merged

wtgodbe merged 3 commits into
dotnet:mainfrom
medhatiwari:fixdetection

Conversation

@medhatiwari

Copy link
Copy Markdown
Contributor

Fix Mono detection in TestPlatformHelper
Summary
Fixes TestPlatformHelper.IsMono to detect modern Mono runtime (.NET 6+).

Problem
IsMono only checked for Mono.Runtime type, which exists in old Mono but not modern Mono (.NET 6+). This caused tests marked with [FrameworkSkipCondition(RuntimeFrameworks.Mono)] to run on Mono when they should have been skipped.

cc: @giritrivedi

@github-actions github-actions Bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label Apr 27, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Apr 27, 2026
@wtgodbe

wtgodbe commented Jun 3, 2026

Copy link
Copy Markdown
Member

No need, IsMono isn't used

@wtgodbe wtgodbe closed this Jun 3, 2026
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview6 milestone Jun 3, 2026
@medhatiwari

Copy link
Copy Markdown
Contributor Author

@wtgodbe IsMono is still used, see FrameworkSkipConditionAttribute.cs#L35-L38, which gates 48 tests marked [FrameworkSkipCondition(RuntimeFrameworks.Mono)].

On .NET 6+, Mono.Runtime isn't present (TestPlatformHelper.cs#L11-L12), so detection fails and those tests run instead of being skipped. We see this on s390x Mono CI, e.g. DefaultObjectValidatorTests.cs#L574-L576 failed when it should have been skipped.

I understand aspnetcore's official CI doesn't run on Mono, but we maintain our own downstream CI on s390x/ppc64le with the mono-based .NET runtime

@wtgodbe wtgodbe reopened this Jun 5, 2026
@wtgodbe
wtgodbe merged commit 83da19a into dotnet:main Jun 24, 2026
20 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants