Skip to content

Commit cb1a6be

Browse files
kotlarmilosCopilot
andcommitted
Root inherited MemberData statics against the trimmer on maccatalyst 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>
1 parent c95ffd0 commit cb1a6be

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/libraries/System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ public void Ctor_NullSocket_ThrowsArgumentNullExceptions()
4545
AssertExtensions.Throws<ArgumentNullException>("socket", () => new NetworkStream(null, FileAccess.ReadWrite, false));
4646
}
4747

48-
[Theory]
48+
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsMultithreadingSupported))]
4949
[MemberData(nameof(ConnectedStreamConformanceTests.CopyToAsync_AllDataCopied_MemberData), MemberType = typeof(ConnectedStreamConformanceTests))]
5050
[DynamicDependency(nameof(ConnectedStreamConformanceTests.CopyToAsync_AllDataCopied_MemberData), typeof(ConnectedStreamConformanceTests))]
51-
[SkipOnPlatform(TestPlatforms.Android | TestPlatforms.iOS | TestPlatforms.tvOS, "Mobile platforms block binding to UNIX sockets")]
51+
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets in our CI environment")]
52+
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
5253
public override Task CopyToAsync_AllDataCopied(int byteCount, bool useAsync) =>
5354
base.CopyToAsync_AllDataCopied(byteCount, useAsync);
5455

src/libraries/System.Security.Cryptography/tests/CryptoStream.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ protected override Task<StreamPair> CreateWrappedConnectedStreamsAsync(StreamPai
3939
[Theory]
4040
[MemberData(nameof(ConnectedStreamConformanceTests.ReadWrite_Success_MemberData), MemberType = typeof(ConnectedStreamConformanceTests))]
4141
[DynamicDependency(nameof(ConnectedStreamConformanceTests.ReadWrite_Success_MemberData), typeof(ConnectedStreamConformanceTests))]
42-
[SkipOnPlatform(TestPlatforms.Android | TestPlatforms.iOS | TestPlatforms.tvOS, "Mobile platforms block binding to UNIX sockets")]
42+
[SkipOnPlatform(TestPlatforms.LinuxBionic, "SElinux blocks UNIX sockets in our CI environment")]
43+
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "iOS/tvOS blocks binding to UNIX sockets")]
4344
public override Task ReadWrite_Success(ReadWriteMode mode, int writeSize, bool startWithFlush) => base.ReadWrite_Success(mode, writeSize, startWithFlush);
4445

4546
[Fact]

0 commit comments

Comments
 (0)