Fix trimming test exclusions for iOS/tvOS simulator CoreCLR builds#127465
Open
tarekgh wants to merge 1 commit intodotnet:mainfrom
Open
Fix trimming test exclusions for iOS/tvOS simulator CoreCLR builds#127465tarekgh wants to merge 1 commit intodotnet:mainfrom
tarekgh wants to merge 1 commit intodotnet:mainfrom
Conversation
The aggressive trimming test exclusion condition in tests.proj only checked for 'ios', 'tvos', and 'maccatalyst' TargetOS values, missing 'iossimulator' and 'tvossimulator'. This caused trimming-sensitive tests (EventSource, DI, DiagnosticSource, etc.) to run on iOS CoreCLR simulator Release builds where EnableAggressiveTrimming=true (added by PR dotnet#127054), resulting in NullReferenceException failures when trimmed reflection metadata was accessed. Replace the explicit TargetOS list with the TargetsAppleMobile property (defined in eng/OSArch.props) which covers all five Apple mobile targets and is already used elsewhere in the same file. Fixes dotnet#127449 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a gap in the libraries test exclusion logic for aggressive trimming scenarios by switching from an explicit TargetOS list (ios/tvos/maccatalyst) to the broader TargetsAppleMobile predicate. This ensures CoreCLR iOS/tvOS simulator Helix builds (where TargetOS is iossimulator / tvossimulator) correctly apply the intended trimming-related project exclusions.
Changes:
- Replace the Apple-mobile
TargetOSdisjunction with$(TargetsAppleMobile) == 'true'in the aggressive trimming exclusion condition. - Ensure trimming-sensitive test projects are excluded consistently across all Apple mobile TargetOS values (including simulators) when running on Helix.
Member
Author
Contributor
|
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger |
Member
Author
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Apr 27, 2026
Open
Open
svick
approved these changes
Apr 28, 2026
rosebyte
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was AI/Copilot-generated.
Summary
The aggressive trimming test exclusion condition in \src/libraries/tests.proj\ only checked for \ios, \ vos, and \maccatalyst\ TargetOS values, missing \iossimulator\ and \ vossimulator. This caused trimming-sensitive tests to run — and fail — on iOS CoreCLR simulator Release builds where \EnableAggressiveTrimming=true\ was recently enabled by #127054.
Root Cause
PR #127054 (April 20) enabled \EnableAggressiveTrimming=true\ for iOS CoreCLR simulator Release builds. Aggressive trimming strips EventSource reflection metadata (\ParameterInfo[]), causing \PayloadNames\ to throw \NullReferenceException\ when accessed.
The test exclusion at line 381 of \ ests.proj\ had three clauses:
For simulator builds, \TargetOS\ is \iossimulator\ or \ vossimulator\ (not \ios/\ vos), confirmed by \�ng/RuntimeIdentifier.props:61-63. So the exclusion didn't match, and 8+ trimming-sensitive tests ran and failed with NRE.
Fix
Replace the explicit TargetOS list with the \TargetsAppleMobile\ property (defined in \�ng/OSArch.props), which covers all five Apple mobile targets (\ios, \iossimulator, \ vos, \ vossimulator, \maccatalyst) and is already used elsewhere in the same file (lines 303, 337, 654, 765).
Fixes #127449
Related: #127448 (DI/Hosting failures on same build — same root cause)