Skip to content

[clr-ios] Preserve inherited MemberData statics on maccatalyst CoreCLR#128409

Open
kotlarmilos wants to merge 10 commits into
dotnet:mainfrom
kotlarmilos:kotlarmilos/fix-mobile-clr-test-failures
Open

[clr-ios] Preserve inherited MemberData statics on maccatalyst CoreCLR#128409
kotlarmilos wants to merge 10 commits into
dotnet:mainfrom
kotlarmilos:kotlarmilos/fix-mobile-clr-test-failures

Conversation

@kotlarmilos

@kotlarmilos kotlarmilos commented May 20, 2026

Copy link
Copy Markdown
Member

Description

On maccatalyst-arm64 AllSubsets_CoreCLR, ILLink strips the inherited ReadWrite_Success_MemberData and CopyToAsync_AllDataCopied_MemberData statics on ConnectedStreamConformanceTests, so xUnit's [MemberData] lookup fails for CryptoStreamTests.ReadWrite_Success and NetworkStreamTest.CopyToAsync_AllDataCopied. Adds a [DynamicDependency] on each derived override to root the base statics, and restores the IsMultithreadingSupported guard on CopyToAsync_AllDataCopied.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 20, 2026 15:33
@kotlarmilos kotlarmilos marked this pull request as draft May 20, 2026 15:33
@kotlarmilos

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts a handful of library test cases to run (or skip) correctly on newly-enabled CoreCLR Apple mobile test legs by updating xUnit data discovery patterns and adding platform/trimming-related guards.

Changes:

  • Add/adjust theory data sourcing to avoid xUnit MemberData resolution problems in derived/overridden conformance tests.
  • Skip or expand existing platform exclusions for tests that rely on desktop-only behaviors (e.g., TPA/fusion log details, reflection emit under aggressive trimming).
  • Expand an existing ActiveIssue to include MacCatalyst and gate a debugger-proxy test away from NativeAOT.
Show a summary per file
File Description
src/libraries/System.Security.Cryptography/tests/CryptoStream.cs Adds an override using explicit MemberType for MemberData to stabilize conformance theory data discovery.
src/libraries/System.Runtime.Loader/tests/TpaLoadFailureTest.cs Skips path/fusion-log validation tests on Apple mobile where the assumptions don’t hold.
src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs Expands an ActiveIssue platform mask to include MacCatalyst.
src/libraries/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.cs Adds an override to supply MemberType for MemberData on a conformance theory.
src/libraries/System.Linq.Expressions/tests/DebuggerTypeProxy/ExpressionDebuggerTypeProxyTests.cs Gates a reflection-heavy theory away from NativeAOT via ConditionalTheory.
src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/Internal/HostTests.cs Further gates Moq/RefEmit-based tests away from aggressively-trimmed/AOT-like environments.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

Comment thread src/libraries/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.cs Outdated
This was referenced May 21, 2026
@kotlarmilos

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI review requested due to automatic review settings June 2, 2026 12:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread src/libraries/System.Security.Cryptography/tests/CryptoStream.cs
Comment thread src/libraries/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.cs Outdated
Copilot AI review requested due to automatic review settings June 9, 2026 10:02
@kotlarmilos kotlarmilos force-pushed the kotlarmilos/fix-mobile-clr-test-failures branch from 943dd48 to 89a6b9b Compare June 9, 2026 10:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread src/libraries/System.Security.Cryptography/tests/CryptoStream.cs Outdated
Comment thread src/libraries/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.cs Outdated
…CoreCLR

On maccatalyst-arm64 AllSubsets_CoreCLR (runtime-extra-platforms), ILLink strips
the inherited ConnectedStreamConformanceTests.ReadWrite_Success_MemberData and
CopyToAsync_AllDataCopied_MemberData statics, so xUnit's [MemberData] discovery
throws ArgumentException ("Could not find public static member ...") before the
test body runs, on CryptoStreamTests.ReadWrite_Success and
NetworkStreamTest.CopyToAsync_AllDataCopied.

Override each test to add a [DynamicDependency] root keeping the base statics
alive under trimming. xUnit does not inherit attributes from overridden virtual
methods, so the overrides also restate the base gating: the
IsMultithreadingSupported ConditionalTheory (System.Net.Sockets.Tests runs on
single-threaded wasi in CI) and the LinuxBionic and iOS/tvOS platform skips.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos kotlarmilos force-pushed the kotlarmilos/fix-mobile-clr-test-failures branch from 89a6b9b to cb1a6be Compare June 9, 2026 10:19
CryptoStreamTests wraps in-memory ConnectedStreams.CreateBidirectional(),
not sockets, so the LinuxBionic/iOS/tvOS skips (reasoned as UNIX-socket
restrictions) do not apply. The sibling ReadWrite_Success_Large override
in the same class carries no such skips. The override keeps [Theory],
qualified [MemberData], and [DynamicDependency] to root the inherited
static MemberData against the trimmer on maccatalyst CoreCLR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 9, 2026 10:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment thread src/libraries/System.Security.Cryptography/tests/CryptoStream.cs
NetworkStreamTest binds TCP loopback sockets; the restriction is the CI
sandbox blocking socket binding, not UNIX sockets specifically. Collapse
the LinuxBionic and iOS/tvOS skips into a single SkipOnPlatform with a
clearer reason.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@kotlarmilos

Copy link
Copy Markdown
Member Author

/azp list

@azure-pipelines

This comment was marked as off-topic.

@kotlarmilos

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@@ -35,6 +36,11 @@ protected override Task<StreamPair> CreateWrappedConnectedStreamsAsync(StreamPai
[MemberData(nameof(ReadWrite_Success_Large_MemberData))]
public override Task ReadWrite_Success_Large(ReadWriteMode mode, int writeSize, bool startWithFlush) => base.ReadWrite_Success_Large(mode, writeSize, startWithFlush);

[Theory]
[MemberData(nameof(ConnectedStreamConformanceTests.ReadWrite_Success_MemberData), MemberType = typeof(ConnectedStreamConformanceTests))]

@BrzVlad BrzVlad Jun 12, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks weird. It is very common to have MemberData in the test suite and it doesn't seem like we need to special case this everywhere else. I suspect the test assembly is rooted so the linker doesn't trim test code. In this case I suspect the assembly containing ConnectedStreamConformanceTests.ReadWrite_Success_MemberData, aka StreamConformanceTests is not rooted for whatever reason.

Looking a bit deeper, this assembly is specially rooted for a bunch of test suites using it ex: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/ILLink.Descriptors.xml. I believe we should do the same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Infrastructure-coreclr Only use for closed issues os-ios Apple iOS

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants