Repository: dotnet/runtime
File: src/libraries/System.Console/tests/ConsoleHandles.cs (C#)

Code before:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using System.IO;
using Microsoft.DotNet.RemoteExecutor;
using Microsoft.Win32.SafeHandles;
using Xunit;

namespace System.Tests
{
    public partial class ConsoleTests
    {
        [Fact]
        [PlatformSpecific(TestPlatforms.AnyUnix | TestPlatforms.Windows)]
        public void OpenStandardInputHandle_ReturnsValidHandle()
        {
            using SafeFileHandle inputHandle = Console.OpenStandardInputHandle();
            Assert.NotNull(inputHandle);
            Assert.False(inputHandle.IsInvalid);
            Assert.False(inputHandle.IsClosed);
        }

        [Fact]
        [PlatformSpecific(TestPlatforms.AnyUnix | TestPlatforms.Windows)]
        public void OpenStandardOutputHandle_ReturnsValidHandle()
        {
            using SafeFileHandle outputHandle = Console.OpenStandardOutputHandle();
            Assert.NotNull(outputHandle);
            Assert.False(outputHandle.IsInvalid);
            Assert.False(outputHandle.IsClosed);
        }

        [Fact]
        [PlatformSpecific(TestPlatforms.AnyUnix | TestPlatforms.Windows)]
        public void OpenStandardErrorHandle_ReturnsValidHandle()
        {
            using SafeFileHandle errorHandle = Console.OpenStandardErrorHandle();
            Assert.NotNull(errorHandle);
            Assert.False(errorHandle.IsInvalid);

Review comment (bug):
`AnyUnix` includes `iOS` and other mobile unix platforms (see https://github.com/dotnet/arcade/blob/4e7da73b7b7dca132b9f87ecf8254ec673eafc58/src/Microsoft.DotNet.XUnitExtensions.Shared/TestPlatforms.cs#L26). OpenStandardInputHandle is not supported on iOS, so this test is going to fail there.

This condition needs to match the support matrix. 

You can use a condition that excludes unsupported platforms, like `[PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.tvOS)]`

Code after:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using System.IO;
using Microsoft.DotNet.RemoteExecutor;
using Microsoft.Win32.SafeHandles;
using Xunit;

namespace System.Tests
{
    public partial class ConsoleTests
    {
        [Fact]
        [PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.Android)]
        public void OpenStandardInputHandle_ReturnsValidHandle()
        {
            using SafeFileHandle inputHandle = Console.OpenStandardInputHandle();
            Assert.NotNull(inputHandle);
            Assert.False(inputHandle.IsInvalid);
            Assert.False(inputHandle.IsClosed);
        }

        [Fact]
        [PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.Android)]
        public void OpenStandardOutputHandle_ReturnsValidHandle()
        {
            using SafeFileHandle outputHandle = Console.OpenStandardOutputHandle();
            Assert.NotNull(outputHandle);
            Assert.False(outputHandle.IsInvalid);
            Assert.False(outputHandle.IsClosed);
        }

        [Fact]
        [PlatformSpecific(TestPlatforms.Any & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.Android)]
        public void OpenStandardErrorHandle_ReturnsValidHandle()
        {
            using SafeFileHandle errorHandle = Console.OpenStandardErrorHandle();
            Assert.NotNull(errorHandle);
            Assert.False(errorHandle.IsInvalid);