[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 42 commits intodotnet:mainfrom
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.
src/libraries/System.Runtime.Loader/tests/RefEmitLoadContext/RefEmitLoadContextTest.cs
Show resolved
Hide resolved
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.
|
/azp run runtime-ioslike |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…maccatalyst platform configurations
eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml
Show resolved
Hide resolved
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/CompilerServices/RuntimeFeatureTests.cs:49
- In DynamicCode_Jit(), the Apple mobile-specific expectation (IsDynamicCodeSupported == true, IsDynamicCodeCompiled == false) was removed, and the remaining else-branch now asserts IsDynamicCodeCompiled == true for all non-NativeAOT runtimes. iOS/tvOS generally do not support JITted dynamic code, so this would make the test incorrect if/when the ActiveIssue gate is removed; consider restoring a platform-specific expectation (or using an existing PlatformDetection predicate that reflects dynamic code compilation support).
...ostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/FileVersionInfoTest.cs
Show resolved
Hide resolved
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| } | ||
| #if defined(TARGET_IOS) || defined(TARGET_TVOS) | ||
| // On iOS/tvOS devices, utsname.machine returns the hardware model rather than the CPU architecture. | ||
| // Fall back to the compile-time target architecture. |
There was a problem hiding this comment.
how did this work on mono before?
|
I created #126754 so that this failure shows as known until we get the fix merged. |
|
@kotlarmilos what failure you're after with the increased timeout. Based on my analysis this would require a change to as well, since the actual failures is the timeout of the helix job it seems. |
| else if (PlatformDetection.IsAppleMobile) | ||
| { | ||
| Assert.True(RuntimeFeature.IsDynamicCodeSupported); | ||
| Assert.False(RuntimeFeature.IsDynamicCodeCompiled); |
There was a problem hiding this comment.
This test looks right. Why remove it?
IsDynamicCodeCompiled should be false on platforms with interpreter (ie AppleMobile and wasm).
| }; | ||
|
|
||
| if (!hasGvmOpenDelegateBug) | ||
| // On Apple mobile CoreCLR, open delegates for interface methods are not supported |
There was a problem hiding this comment.
Is there an issue with more context that we can link from here?
(I assume that we have decided that it is not worth it to do the work required to support these.)
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.