[mobile] Skip ConcurrentDictionary reflection test on mobile platforms#127861
[mobile] Skip ConcurrentDictionary reflection test on mobile platforms#127861github-actions[bot] wants to merge 3 commits intomainfrom
Conversation
The test NonRandomizedToRandomizedUpgrade_FunctionsCorrectly uses Type.GetType to load the nested ConcurrentDictionary+Tables type, which fails with TypeLoadException on iOS, tvOS, macCatalyst, and Android. Fixes test failure in runtime-extra-platforms pipeline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Tagging subscribers to this area: @dotnet/area-system-collections |
🤖 Copilot Code Review — PR #127861Note This review was generated by Copilot. Holistic AssessmentMotivation: The test Approach: Using Summary: ✅ LGTM. This is a straightforward, low-risk test infrastructure fix. The attribute usage follows established patterns in the repo, the platform list is correct, and the skip reason accurately describes the limitation. Detailed Findings✅ Correct Use of
|
There was a problem hiding this comment.
Pull request overview
This PR addresses mobile test failures in System.Collections.Concurrent.Tests by skipping a ConcurrentDictionary test that relies on reflection over private nested implementation types, which is not reliable on trimmed/AOT mobile platforms.
Changes:
- Skip
NonRandomizedToRandomizedUpgrade_FunctionsCorrectlyon iOS, tvOS, MacCatalyst, and Android via[SkipOnPlatform]. - Preserve existing trimming-related gating (
[ActiveIssue(... IsBuiltWithAggressiveTrimming)]) while adding explicit mobile platform exclusion.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionary.Generic.Tests.cs | Skips the reflection-based ConcurrentDictionary implementation-detail test on mobile platforms where Type.GetType/private-type reflection is not supported under trimming/AOT. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b659870c-8b89-4bd5-9116-3e2ecaee098f Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
Reasoning
The test
ConcurrentDictionary_Generic_Tests_string_string.NonRandomizedToRandomizedUpgrade_FunctionsCorrectlyuses reflection viaType.GetType("System.Collections.Concurrent.ConcurrentDictionary2+Tables, System.Collections.Concurrent", throwOnError: true)to load a nested private type from ConcurrentDictionary's implementation. This reflection call fails on iOS, tvOS, macCatalyst, and Android withTypeLoadException: Could not load type 'System.Collections.Concurrent.ConcurrentDictionary`2' from assembly 'System.Collections.Concurrent'`.The test is attempting to inspect internal implementation details (the private
_tablesfield and the nestedTablestype) to extract the hash code function from the comparer. This level of reflection into nested types and private members is not supported on mobile platforms where assemblies are trimmed and/or AOT-compiled.Since the test is verifying internal implementation behavior rather than public API contracts, and the failure is specific to reflection limitations on mobile platforms (not a product bug affecting end users), the appropriate fix is to skip the test on these platforms using
[SkipOnPlatform].Impact on platforms
Failing on all tested mobile platforms in build 1406427 (2026-05-03):
Errors log
From tvos-arm64 Helix work item
System.Collections.Concurrent.Tests(console log):First build it occurred
First observed (within the scanned window) in build 1406427, which finished on 2026-05-03T09:02:27Z.
Note: This is computed within the last ~20 builds scanned and may not be the true origin. The test may have been failing on mobile platforms since its introduction, as it relies on reflection capabilities not available in trimmed/AOT mobile builds.
Note
This change was generated by the Mobile Platform Failure Scanner workflow.