Uh oh!
There was an error while loading. Please reload this page.
[ios-clr] Fix library test failures on Apple mobile platforms - #125439
[ios-clr] Fix library test failures on Apple mobile platforms#125439kotlarmilos wants to merge 59 commits into
Conversation
…pdate project exclusions
There was a problem hiding this comment.
Pull request overview
This PR aims to address failing test runs on Apple mobile (iOS/tvOS) when using CoreCLR by re-enabling previously skipped coverage and adjusting test/build configuration so those tests can execute successfully.
Changes:
- Removed Apple mobile/CoreCLR
ActiveIssueskips across several library tests and removed some Apple mobile project exclusions. - Updated
CustomAttributeDecoderTeststo derive the expectedSystem.Typeassembly-qualified string from metadata (more resilient to trimming/ILLink differences). - Adjusted test build targets to allow preview features/runtime-async on Apple mobile targets.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/tests.proj | Removes Apple mobile/CoreCLR exclusions for specific test projects so they run again. |
| src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/InvokeWithRefLikeArgs.cs | Re-enables a previously skipped Apple mobile/CoreCLR test (still guarded by Reflection.Emit support). |
| src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs | Re-enables a previously skipped Apple mobile/CoreCLR calendar parsing test. |
| src/libraries/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs | Re-enables a previously skipped Apple mobile/CoreCLR Reflection.Emit load-context test. |
| src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/CustomAttributes/DllImportTests.cs | Reorders ActiveIssue attributes (no behavioral code change). |
| src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs | Makes expected System.Type string match decoder output post-trimming and avoids using Type.GetType for enum underlying types. |
| src/libraries/System.Collections/tests/BitArray/BitArray_CtorTests.cs | Re-enables a previously skipped Apple mobile/CoreCLR BitArray clone test. |
| eng/testing/tests.targets | Enables preview features/runtime-async for Apple mobile targets by removing an exclusion. |
Comments suppressed due to low confidence (2)
src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/CalendarTestWithConfigSwitch/CalendarTests.cs:25
- The test comment says the legacy behavior "On mobile, this does not throw", but after removing the Apple mobile skip this test will run on Apple mobile and still asserts a FormatException. Either update the comment to the specific platform(s) where it doesn’t throw (e.g., Android-only), or extend the skip/condition so the assertion matches actual mobile behavior.
[Fact]
[SkipOnPlatform(TestPlatforms.Android, "Doesn't throw on mobile")]
public static void TestJapaneseCalendarDateParsing()
{
CultureInfo ciJapanese = new CultureInfo("ja-JP") { DateTimeFormat = { Calendar = new JapaneseCalendar() } };
DateTime dt = new DateTime(1970, 1, 1);
string eraName = dt.ToString("gg", ciJapanese);
// Legacy behavior which we used to throw when using a year number exceeding the era max year.
//
// On mobile, this does not throw, but instead produces a DateTime w/ 95/01/01
Assert.ThrowsAny<FormatException>(() => DateTime.Parse(eraName + " 70/1/1 0:00:00", ciJapanese));
}
src/libraries/System.Collections/tests/BitArray/BitArray_CtorTests.cs:280
- Re-enabling this test on Apple mobile means it will allocate a BitArray of length int.MaxValue-30 (~256MB+), which is likely to OOM or heavily destabilize test runs on memory-constrained devices. Consider reducing the allocation size while still covering the clone path, or gating this test (e.g., OuterLoop / platform-conditional) for constrained environments.
[Fact]
public static void Clone_LongLength_Works()
{
BitArray bitArray = new BitArray(int.MaxValue - 30);
BitArray clone = (BitArray)bitArray.Clone();
Assert.Equal(bitArray.Length, clone.Length);
}
You can also share your feedback on Copilot code review. Take the survey.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
You can also share your feedback on Copilot code review. Take the survey.
kotlarmilos
commented
Mar 13, 2026
/azp run runtime-ioslike |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…maccatalyst platform configurations
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…remove Apple mobile specific checks; update AssemblyLoadContextTest to exclude MacCatalyst; remove unused ILLink descriptors; clean up AppleBuild.props by removing obsolete properties.
…milos/runtime into improvement/ios-clr-library-tests
… assertions and improve clarity
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
… with ActiveIssue for iOS and tvOS
…Name initialization by removing Apple mobile condition
…est to simplify condition for FMA support
kotlarmilos
commented
Apr 15, 2026
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| // After ILLink/trimming, type references may point to System.Private.CoreLib | ||
| // instead of System.Runtime. Read the actual assembly reference from metadata | ||
| // so that expected values match what the decoder produces. | ||
| private static readonly string s_systemTypeString = GetSystemTypeStringFromMetadata(); |
There was a problem hiding this comment.
@sbomer if we were to set trim action to copy on the test assembly, would this still rewrite forwarders, or would it keep things?
(I'm not a fan of this extra complexity)
kotlarmilos
commented
Apr 17, 2026
This PR is too broad, splitting it into smaller more focused PRs instead |
Description
This PR fixes CoreCLR library test failures on Apple mobile platforms (iOS, tvOS, MacCatalyst) across simulators and devices. It resolves a native crash in SystemNative_GetOSArchitecture where utsname.machine returns hardware model identifiers instead of CPU architecture strings on real devices, causing a debug assert to fire. It skips tests on iOS/tvOS where the diagnostics IPC socket is unreachable inside the app sandbox. It also removes stale ActiveIssue attributes, updates test skip conditions for platform-specific behavior, fixes ILLink descriptor configurations, increases CI pipeline timeouts.