Skip to content

Commit 24c5e6f

Browse files
[mobile] Add MacCatalyst to Console OpenStandardHandle test exclusions (#127274)
Fixes System.Console.Tests failures on MacCatalyst discovered in runtime-extra-platforms build [#1388505](https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1388505). ## Failure **Build**: [#1388505](https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1388505) (2026-04-21) **Job**: `maccatalyst-arm64 Release AllSubsets_Mono` **Helix job**: `f4caa84e-1526-4c12-a872-6f24ac6f3ba1` **Work item**: System.Console.Tests **Platform**: MacCatalyst arm64 (also affects maccatalyst-x64) ### Failed tests Four tests failed with `PlatformNotSupportedException`: 1. `OpenStandardInputHandle_ReturnsValidHandle` 2. `OpenStandardOutputHandle_ReturnsValidHandle` 3. `OpenStandardErrorHandle_ReturnsValidHandle` 4. `OpenStandardHandles_DoNotOwnHandle` ````text [FAIL] System.Tests.ConsoleTests.OpenStandardInputHandle_ReturnsValidHandle System.PlatformNotSupportedException : Operation is not supported on this platform. at System.ConsolePal.OpenStandardInputHandle() at System.Console.OpenStandardInputHandle() ```` ### Root cause The `Console.OpenStandardXXXHandle()` methods throw `PlatformNotSupportedException` on mobile platforms (iOS, tvOS, Android, MacCatalyst) because these platforms do not expose the underlying file handles for standard streams. The existing tests already had `[PlatformSpecific]` attributes excluding iOS, tvOS, and Android, but **MacCatalyst was missing** from the exclusion list. This is an oversight because MacCatalyst has the same limitation as other Apple mobile platforms. ### Fix Add `TestPlatforms.MacCatalyst` to the exclusion list (using `& ~TestPlatforms.MacCatalyst`) on all five tests that attempt to use these APIs, and add it to the inclusion list on the three "ThrowsOnUnsupportedPlatforms" tests that validate the exception is thrown. This makes the skip coverage consistent across all mobile platforms: - Skip on: iOS, tvOS, MacCatalyst, Android, Browser (where applicable) - Run on: Windows, Linux, macOS desktop ## Testing After this fix, the four failing tests will be skipped on MacCatalyst in the `runtime-extra-platforms` pipeline, matching the behavior on iOS, tvOS, and Android. --- > [!NOTE] > This PR was created by GitHub Copilot after analyzing mobile platform CI failures in the runtime-extra-platforms pipeline (build 1388505). > [!NOTE] > <details> > <summary>🔒 Integrity filter blocked 1 item</summary> > > The following item were blocked because they don't meet the GitHub integrity level. > > - [#126805](#126805) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved". > > To allow these resources, lower `min-integrity` in your GitHub frontmatter: > > ```yaml > tools: > github: > min-integrity: approved # merged | approved | unapproved | none > ``` > > </details> > Generated by [Mobile Platform Failure Scanner](https://github.com/dotnet/runtime/actions/runs/24774805343/agentic_workflow) · ● 2.2M · [◷](https://github.com/search?q=repo%3Adotnet%2Fruntime+%22gh-aw-workflow-id%3A+mobile-scan%22&type=pullrequests) <!-- gh-aw-agentic-workflow: Mobile Platform Failure Scanner, engine: copilot, model: claude-sonnet-4.5, id: 24774805343, workflow_id: mobile-scan, run: https://github.com/dotnet/runtime/actions/runs/24774805343 --> <!-- gh-aw-workflow-id: mobile-scan --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 0f91c41 commit 24c5e6f

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/libraries/System.Console/tests/ConsoleHandles.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace System.Tests
1313
public partial class ConsoleTests
1414
{
1515
[Fact]
16-
[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.Android)]
16+
[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.Android)]
1717
public void OpenStandardInputHandle_ReturnsValidHandle()
1818
{
1919
using SafeFileHandle inputHandle = Console.OpenStandardInputHandle();
@@ -23,7 +23,7 @@ public void OpenStandardInputHandle_ReturnsValidHandle()
2323
}
2424

2525
[Fact]
26-
[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.Android)]
26+
[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.Android)]
2727
public void OpenStandardOutputHandle_ReturnsValidHandle()
2828
{
2929
using SafeFileHandle outputHandle = Console.OpenStandardOutputHandle();
@@ -33,7 +33,7 @@ public void OpenStandardOutputHandle_ReturnsValidHandle()
3333
}
3434

3535
[Fact]
36-
[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.Android)]
36+
[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.Android)]
3737
public void OpenStandardErrorHandle_ReturnsValidHandle()
3838
{
3939
using SafeFileHandle errorHandle = Console.OpenStandardErrorHandle();
@@ -43,7 +43,7 @@ public void OpenStandardErrorHandle_ReturnsValidHandle()
4343
}
4444

4545
[Fact]
46-
[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.Android)]
46+
[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.Android)]
4747
public void OpenStandardHandles_DoNotOwnHandle()
4848
{
4949
SafeFileHandle inputHandle = Console.OpenStandardInputHandle();
@@ -69,7 +69,7 @@ public void OpenStandardHandles_DoNotOwnHandle()
6969
}
7070

7171
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
72-
[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.Android)]
72+
[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.Android)]
7373
public void OpenStandardHandles_CanBeUsedWithStream()
7474
{
7575
using RemoteInvokeHandle child = RemoteExecutor.Invoke(() =>
@@ -149,21 +149,21 @@ public void UnixConsoleStream_SeekableStdoutRedirection_WritesAllContent()
149149
}
150150

151151
[Fact]
152-
[PlatformSpecific(TestPlatforms.Android | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Browser)]
152+
[PlatformSpecific(TestPlatforms.Android | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst | TestPlatforms.Browser)]
153153
public void OpenStandardInputHandle_ThrowsOnUnsupportedPlatforms()
154154
{
155155
Assert.Throws<PlatformNotSupportedException>(() => Console.OpenStandardInputHandle());
156156
}
157157

158158
[Fact]
159-
[PlatformSpecific(TestPlatforms.Android | TestPlatforms.iOS | TestPlatforms.tvOS)]
159+
[PlatformSpecific(TestPlatforms.Android | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
160160
public void OpenStandardOutputHandle_ThrowsOnUnsupportedPlatforms()
161161
{
162162
Assert.Throws<PlatformNotSupportedException>(() => Console.OpenStandardOutputHandle());
163163
}
164164

165165
[Fact]
166-
[PlatformSpecific(TestPlatforms.Android | TestPlatforms.iOS | TestPlatforms.tvOS)]
166+
[PlatformSpecific(TestPlatforms.Android | TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
167167
public void OpenStandardErrorHandle_ThrowsOnUnsupportedPlatforms()
168168
{
169169
Assert.Throws<PlatformNotSupportedException>(() => Console.OpenStandardErrorHandle());

0 commit comments

Comments
 (0)