From f4f028b4ae161096e1f96731453779148a3270ec Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Fri, 16 Sep 2022 15:24:30 +0900 Subject: [PATCH 01/12] Impl Console.SetWindowSize() for linux --- .../System.Native/Interop.GetWindowWidth.cs | 3 ++ .../System.Console/ref/System.Console.cs | 5 +-- .../System.Console/src/Resources/Strings.resx | 3 ++ .../System.Console/src/System/Console.cs | 3 ++ .../src/System/ConsolePal.Unix.cs | 34 +++++++++++++++++-- .../tests/WindowAndCursorProps.cs | 25 ++------------ src/native/libs/Common/pal_config.h.in | 1 + src/native/libs/System.Native/entrypoints.c | 1 + src/native/libs/System.Native/pal_console.c | 13 +++++++ src/native/libs/System.Native/pal_console.h | 9 ++++- src/native/libs/configure.cmake | 5 +++ 11 files changed, 73 insertions(+), 29 deletions(-) diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetWindowWidth.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetWindowWidth.cs index ea3ef66dea448..73f35d6a5ed65 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetWindowWidth.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetWindowWidth.cs @@ -19,5 +19,8 @@ internal struct WinSize [LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetWindowSize", SetLastError = true)] internal static partial int GetWindowSize(out WinSize winSize); + + [LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetWindowSize", SetLastError = true)] + internal static partial int SetWindowSize(in WinSize winSize); } } diff --git a/src/libraries/System.Console/ref/System.Console.cs b/src/libraries/System.Console/ref/System.Console.cs index 9a4c6b10f4087..d7d8a26032fdc 100644 --- a/src/libraries/System.Console/ref/System.Console.cs +++ b/src/libraries/System.Console/ref/System.Console.cs @@ -69,10 +69,10 @@ public static partial class Console [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static bool TreatControlCAsInput { get { throw null; } set { } } - public static int WindowHeight { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } + public static int WindowHeight { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows"), System.Runtime.Versioning.SupportedOSPlatformAttribute("linux")] set { } } public static int WindowLeft { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } public static int WindowTop { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } - public static int WindowWidth { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } + public static int WindowWidth { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows"), System.Runtime.Versioning.SupportedOSPlatformAttribute("linux")] set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] @@ -148,6 +148,7 @@ public static void SetOut(System.IO.TextWriter newOut) { } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public static void SetWindowPosition(int left, int top) { } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("linux")] public static void SetWindowSize(int width, int height) { } public static void Write(bool value) { } public static void Write(char value) { } diff --git a/src/libraries/System.Console/src/Resources/Strings.resx b/src/libraries/System.Console/src/Resources/Strings.resx index d6b48e2da57fe..980613c28a5ff 100644 --- a/src/libraries/System.Console/src/Resources/Strings.resx +++ b/src/libraries/System.Console/src/Resources/Strings.resx @@ -194,6 +194,9 @@ Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read. + + Cannot set window size when console output has been redirected. + The home directory of the current user could not be determined. diff --git a/src/libraries/System.Console/src/System/Console.cs b/src/libraries/System.Console/src/System/Console.cs index a4b4cc969db18..fa671e7e65475 100644 --- a/src/libraries/System.Console/src/System/Console.cs +++ b/src/libraries/System.Console/src/System/Console.cs @@ -400,6 +400,7 @@ public static int WindowWidth [UnsupportedOSPlatform("tvos")] get { return ConsolePal.WindowWidth; } [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] set { ConsolePal.WindowWidth = value; } } @@ -411,6 +412,7 @@ public static int WindowHeight [UnsupportedOSPlatform("tvos")] get { return ConsolePal.WindowHeight; } [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] set { ConsolePal.WindowHeight = value; } } @@ -421,6 +423,7 @@ public static void SetWindowPosition(int left, int top) } [SupportedOSPlatform("windows")] + [SupportedOSPlatform("linux")] public static void SetWindowSize(int width, int height) { ConsolePal.SetWindowSize(width, height); diff --git a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs index 8ba71f36f3063..96e0ed8549948 100644 --- a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs +++ b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs @@ -346,7 +346,10 @@ public static int WindowWidth GetWindowSize(out int width, out _); return width; } - set { throw new PlatformNotSupportedException(); } + set + { + SetWindowSize(value, WindowHeight); + } } public static int WindowHeight @@ -356,7 +359,10 @@ public static int WindowHeight GetWindowSize(out _, out int height); return height; } - set { throw new PlatformNotSupportedException(); } + set + { + SetWindowSize(WindowWidth, value); + } } private static void GetWindowSize(out int width, out int height) @@ -392,7 +398,29 @@ public static void SetWindowPosition(int left, int top) public static void SetWindowSize(int width, int height) { - throw new PlatformNotSupportedException(); + if (Console.IsOutputRedirected) + throw new IOException(SR.InvalidOperation_SetWindowSize); + if (width <= 0) + throw new ArgumentOutOfRangeException(nameof(width), width, SR.ArgumentOutOfRange_NeedPosNum); + if (height <= 0) + throw new ArgumentOutOfRangeException(nameof(height), height, SR.ArgumentOutOfRange_NeedPosNum); + + lock (Console.Out) + { + Interop.Sys.WinSize winsize = default; + winsize.Row = (ushort)height; + winsize.Col = (ushort)width; + if (Interop.Sys.SetWindowSize(in winsize) == 0) + { + s_windowWidth = winsize.Col; + s_windowHeight = winsize.Row; + } + else + { + Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); + throw Interop.GetExceptionForIoErrno(errorInfo); + } + } } public static bool CursorVisible diff --git a/src/libraries/System.Console/tests/WindowAndCursorProps.cs b/src/libraries/System.Console/tests/WindowAndCursorProps.cs index f5ddc739def31..a91563e83c35b 100644 --- a/src/libraries/System.Console/tests/WindowAndCursorProps.cs +++ b/src/libraries/System.Console/tests/WindowAndCursorProps.cs @@ -46,7 +46,7 @@ public static void SetBufferSize_Unix_ThrowsPlatformNotSupportedException() } [Theory] - [PlatformSpecific(TestPlatforms.Windows)] + [PlatformSpecific((TestPlatforms.Windows) | (TestPlatforms.AnyUnix & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.tvOS))] [InlineData(0)] [InlineData(-1)] public static void WindowWidth_SetInvalid_ThrowsArgumentOutOfRangeException(int value) @@ -70,15 +70,8 @@ public static void WindowWidth_GetUnix_Success() Helpers.RunInRedirectedOutput((data) => Console.WriteLine(Console.WindowWidth)); } - [Fact] - [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)] // Expected behavior specific to Unix - public static void WindowWidth_SetUnix_ThrowsPlatformNotSupportedException() - { - Assert.Throws(() => Console.WindowWidth = 100); - } - [Theory] - [PlatformSpecific(TestPlatforms.Windows)] // Expected behavior specific to Windows + [PlatformSpecific((TestPlatforms.Windows) | (TestPlatforms.AnyUnix & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.tvOS))] [InlineData(0)] [InlineData(-1)] public static void WindowHeight_SetInvalid_ThrowsArgumentOutOfRangeException(int value) @@ -102,13 +95,6 @@ public static void WindowHeight_GetUnix_Success() Helpers.RunInRedirectedOutput((data) => Console.WriteLine(Console.WindowHeight)); } - [Fact] - [PlatformSpecific(TestPlatforms.AnyUnix)] // Expected behavior specific to Unix - public static void WindowHeight_SetUnix_ThrowsPlatformNotSupportedException() - { - Assert.Throws(() => Console.WindowHeight = 100); - } - [Fact] [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.tvOS)] // Expected behavior specific to Unix public static void LargestWindowWidth_UnixGet_ReturnsExpected() @@ -586,13 +572,6 @@ public void SetWindowSize_GetWindowSize_ReturnsExpected() } } - [Fact] - [PlatformSpecific(TestPlatforms.AnyUnix)] - public void SetWindowSize_Unix_ThrowsPlatformNotSupportedException() - { - Assert.Throws(() => Console.SetWindowSize(50, 50)); - } - [Fact] [PlatformSpecific(TestPlatforms.Windows)] public void MoveBufferArea_DefaultChar() diff --git a/src/native/libs/Common/pal_config.h.in b/src/native/libs/Common/pal_config.h.in index 6243761d8600d..acacfb33e34a3 100644 --- a/src/native/libs/Common/pal_config.h.in +++ b/src/native/libs/Common/pal_config.h.in @@ -40,6 +40,7 @@ #cmakedefine01 KEVENT_REQUIRES_INT_PARAMS #cmakedefine01 HAVE_IOCTL #cmakedefine01 HAVE_TIOCGWINSZ +#cmakedefine01 HAVE_TIOCSWINSZ #cmakedefine01 HAVE_SCHED_GETAFFINITY #cmakedefine01 HAVE_SCHED_SETAFFINITY #cmakedefine01 HAVE_SCHED_GETCPU diff --git a/src/native/libs/System.Native/entrypoints.c b/src/native/libs/System.Native/entrypoints.c index e254f526a1a43..c4faf76ec7dac 100644 --- a/src/native/libs/System.Native/entrypoints.c +++ b/src/native/libs/System.Native/entrypoints.c @@ -35,6 +35,7 @@ static const Entry s_sysNative[] = { DllImportEntry(SystemNative_FStat) DllImportEntry(SystemNative_GetWindowSize) + DllImportEntry(SystemNative_SetWindowSize) DllImportEntry(SystemNative_IsATty) DllImportEntry(SystemNative_InitializeTerminalAndSignalHandling) DllImportEntry(SystemNative_SetKeypadXmit) diff --git a/src/native/libs/System.Native/pal_console.c b/src/native/libs/System.Native/pal_console.c index 5e13eb7b627b1..073a8f45db9bb 100644 --- a/src/native/libs/System.Native/pal_console.c +++ b/src/native/libs/System.Native/pal_console.c @@ -39,6 +39,19 @@ int32_t SystemNative_GetWindowSize(WinSize* windowSize) #endif } +int32_t SystemNative_SetWindowSize(WinSize* windowSize) +{ + assert(windowSize != NULL); + +#if HAVE_IOCTL && HAVE_TIOCSWINSZ + int error = ioctl(STDOUT_FILENO, TIOCSWINSZ, windowSize); + return error; +#else + errno = ENOTSUP; + return -1; +#endif +} + int32_t SystemNative_IsATty(intptr_t fd) { return isatty(ToFileDescriptor(fd)); diff --git a/src/native/libs/System.Native/pal_console.h b/src/native/libs/System.Native/pal_console.h index ca837c55bc557..46daa3d1ebe6d 100644 --- a/src/native/libs/System.Native/pal_console.h +++ b/src/native/libs/System.Native/pal_console.h @@ -44,10 +44,17 @@ typedef struct /** * Gets the windows size of the terminal * - * Returns 0 on success; otherwise, returns errorNo. + * Returns 0 on success; otherwise, returns -1 and sets errno. */ PALEXPORT int32_t SystemNative_GetWindowSize(WinSize* windowsSize); +/** + * Sets the windows size of the terminal + * + * Returns 0 on success; otherwise, returns -1 and sets errno. + */ +PALEXPORT int32_t SystemNative_SetWindowSize(WinSize* windowsSize); + /** * Gets whether the specified file descriptor is for a terminal. * diff --git a/src/native/libs/configure.cmake b/src/native/libs/configure.cmake index bc6c133fe8921..7c5b88e96d5d0 100644 --- a/src/native/libs/configure.cmake +++ b/src/native/libs/configure.cmake @@ -254,6 +254,11 @@ check_symbol_exists( "sys/ioctl.h" HAVE_TIOCGWINSZ) +check_symbol_exists( + TIOCSWINSZ + "sys/ioctl.h" + HAVE_TIOCSWINSZ) + check_symbol_exists( tcgetattr termios.h From 24b00831bc65f7bdfdb4bafcd553be267543ebdc Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Tue, 20 Sep 2022 08:57:57 +0900 Subject: [PATCH 02/12] Apply Feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stephen Toub Co-authored-by: MichaƂ Petryka <35800402+MichalPetryka@users.noreply.github.com> --- .../System.Console/src/System/Console.cs | 38 ++++++++++++++++++- .../src/System/ConsolePal.Unix.cs | 16 ++++---- .../src/System/ConsolePal.Windows.cs | 5 --- .../tests/WindowAndCursorProps.cs | 21 ++++++++++ 4 files changed, 65 insertions(+), 15 deletions(-) diff --git a/src/libraries/System.Console/src/System/Console.cs b/src/libraries/System.Console/src/System/Console.cs index fa671e7e65475..c22d79cb441b8 100644 --- a/src/libraries/System.Console/src/System/Console.cs +++ b/src/libraries/System.Console/src/System/Console.cs @@ -401,7 +401,18 @@ public static int WindowWidth get { return ConsolePal.WindowWidth; } [SupportedOSPlatform("windows")] [SupportedOSPlatform("linux")] - set { ConsolePal.WindowWidth = value; } + set + { + if (Console.IsOutputRedirected) + { + throw new IOException(SR.InvalidOperation_SetWindowSize); + } + if (value <= 0) + { + throw new ArgumentOutOfRangeException(nameof(value), value, SR.ArgumentOutOfRange_NeedPosNum); + } + ConsolePal.WindowWidth = value; + } } public static int WindowHeight @@ -413,7 +424,18 @@ public static int WindowHeight get { return ConsolePal.WindowHeight; } [SupportedOSPlatform("windows")] [SupportedOSPlatform("linux")] - set { ConsolePal.WindowHeight = value; } + set + { + if (Console.IsOutputRedirected) + { + throw new IOException(SR.InvalidOperation_SetWindowSize); + } + if (value <= 0) + { + throw new ArgumentOutOfRangeException(nameof(value), value, SR.ArgumentOutOfRange_NeedPosNum); + } + ConsolePal.WindowHeight = value; + } } [SupportedOSPlatform("windows")] @@ -426,6 +448,18 @@ public static void SetWindowPosition(int left, int top) [SupportedOSPlatform("linux")] public static void SetWindowSize(int width, int height) { + if (Console.IsOutputRedirected) + { + throw new IOException(SR.InvalidOperation_SetWindowSize); + } + if (width <= 0) + { + throw new ArgumentOutOfRangeException(nameof(width), width, SR.ArgumentOutOfRange_NeedPosNum); + } + if (height <= 0) + { + throw new ArgumentOutOfRangeException(nameof(height), height, SR.ArgumentOutOfRange_NeedPosNum); + } ConsolePal.SetWindowSize(width, height); } diff --git a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs index 96e0ed8549948..d475fdd0211b8 100644 --- a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs +++ b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs @@ -398,13 +398,6 @@ public static void SetWindowPosition(int left, int top) public static void SetWindowSize(int width, int height) { - if (Console.IsOutputRedirected) - throw new IOException(SR.InvalidOperation_SetWindowSize); - if (width <= 0) - throw new ArgumentOutOfRangeException(nameof(width), width, SR.ArgumentOutOfRange_NeedPosNum); - if (height <= 0) - throw new ArgumentOutOfRangeException(nameof(height), height, SR.ArgumentOutOfRange_NeedPosNum); - lock (Console.Out) { Interop.Sys.WinSize winsize = default; @@ -418,7 +411,14 @@ public static void SetWindowSize(int width, int height) else { Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); - throw Interop.GetExceptionForIoErrno(errorInfo); + if (errorInfo.Error == Interop.Error.ENOTSUP) + { + throw new PlatformNotSupportedException(); + } + else + { + throw Interop.GetExceptionForIoErrno(errorInfo); + } } } } diff --git a/src/libraries/System.Console/src/System/ConsolePal.Windows.cs b/src/libraries/System.Console/src/System/ConsolePal.Windows.cs index 28b74832466c7..d8e43d55a9cce 100644 --- a/src/libraries/System.Console/src/System/ConsolePal.Windows.cs +++ b/src/libraries/System.Console/src/System/ConsolePal.Windows.cs @@ -948,11 +948,6 @@ public static unsafe void SetWindowPosition(int left, int top) public static unsafe void SetWindowSize(int width, int height) { - if (width <= 0) - throw new ArgumentOutOfRangeException(nameof(width), width, SR.ArgumentOutOfRange_NeedPosNum); - if (height <= 0) - throw new ArgumentOutOfRangeException(nameof(height), height, SR.ArgumentOutOfRange_NeedPosNum); - // Get the position of the current console window Interop.Kernel32.CONSOLE_SCREEN_BUFFER_INFO csbi = GetBufferInfo(); diff --git a/src/libraries/System.Console/tests/WindowAndCursorProps.cs b/src/libraries/System.Console/tests/WindowAndCursorProps.cs index a91563e83c35b..82e7ad470be5d 100644 --- a/src/libraries/System.Console/tests/WindowAndCursorProps.cs +++ b/src/libraries/System.Console/tests/WindowAndCursorProps.cs @@ -70,6 +70,13 @@ public static void WindowWidth_GetUnix_Success() Helpers.RunInRedirectedOutput((data) => Console.WriteLine(Console.WindowWidth)); } + [Fact] + [PlatformSpecific(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS)] // Expected behavior specific to Unix + public static void WindowWidth_SetUnix_ThrowsPlatformNotSupportedException() + { + Assert.Throws(() => Console.WindowWidth = 100); + } + [Theory] [PlatformSpecific((TestPlatforms.Windows) | (TestPlatforms.AnyUnix & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.tvOS))] [InlineData(0)] @@ -103,6 +110,13 @@ public static void LargestWindowWidth_UnixGet_ReturnsExpected() Helpers.RunInRedirectedOutput((data) => Assert.Equal(Console.WindowWidth, Console.LargestWindowWidth)); } + [Fact] + [PlatformSpecific(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS)] // Expected behavior specific to Unix + public static void WindowHeight_SetUnix_ThrowsPlatformNotSupportedException() + { + Assert.Throws(() => Console.WindowHeight = 100); + } + [Fact] [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.tvOS)] // Expected behavior specific to Unix public static void LargestWindowHeight_UnixGet_ReturnsExpected() @@ -572,6 +586,13 @@ public void SetWindowSize_GetWindowSize_ReturnsExpected() } } + [Fact] + [PlatformSpecific(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS)] + public void SetWindowSize_Unix_ThrowsPlatformNotSupportedException() + { + Assert.Throws(() => Console.SetWindowSize(50, 50)); + } + [Fact] [PlatformSpecific(TestPlatforms.Windows)] public void MoveBufferArea_DefaultChar() From 324b31b36e15e02de392f77230469eaa21641a8c Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Tue, 20 Sep 2022 09:43:05 +0900 Subject: [PATCH 03/12] Throw IOException if fail --- src/libraries/System.Console/src/System/ConsolePal.Unix.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs index d475fdd0211b8..babe1394f47ac 100644 --- a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs +++ b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs @@ -417,7 +417,7 @@ public static void SetWindowSize(int width, int height) } else { - throw Interop.GetExceptionForIoErrno(errorInfo); + throw Interop.GetIOException(errorInfo); } } } From 814d5c0d36661e0f5d4f14a35bbdb86fac2fa007 Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Fri, 30 Sep 2022 08:05:10 +0900 Subject: [PATCH 04/12] Apply suggestions from code review Co-authored-by: Adam Sitnik --- .../System.Console/src/System/ConsolePal.Unix.cs | 10 ++-------- src/native/libs/System.Native/pal_console.c | 3 +-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs index babe1394f47ac..7dd2a44679aa1 100644 --- a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs +++ b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs @@ -346,10 +346,7 @@ public static int WindowWidth GetWindowSize(out int width, out _); return width; } - set - { - SetWindowSize(value, WindowHeight); - } + set => SetWindowSize(value, WindowHeight); } public static int WindowHeight @@ -359,10 +356,7 @@ public static int WindowHeight GetWindowSize(out _, out int height); return height; } - set - { - SetWindowSize(WindowWidth, value); - } + set => SetWindowSize(WindowWidth, value); } private static void GetWindowSize(out int width, out int height) diff --git a/src/native/libs/System.Native/pal_console.c b/src/native/libs/System.Native/pal_console.c index 073a8f45db9bb..1c0c321f4e8a7 100644 --- a/src/native/libs/System.Native/pal_console.c +++ b/src/native/libs/System.Native/pal_console.c @@ -44,8 +44,7 @@ int32_t SystemNative_SetWindowSize(WinSize* windowSize) assert(windowSize != NULL); #if HAVE_IOCTL && HAVE_TIOCSWINSZ - int error = ioctl(STDOUT_FILENO, TIOCSWINSZ, windowSize); - return error; + return ioctl(STDOUT_FILENO, TIOCSWINSZ, windowSize); #else errno = ENOTSUP; return -1; From e8fd3ac8f711b1094f983ce3a114b83cdac6f0f0 Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Fri, 30 Sep 2022 09:40:38 +0900 Subject: [PATCH 05/12] Add supportplatform freebsd & osx --- src/libraries/System.Console/ref/System.Console.cs | 6 ++++-- src/libraries/System.Console/src/System/Console.cs | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Console/ref/System.Console.cs b/src/libraries/System.Console/ref/System.Console.cs index d7d8a26032fdc..6d62134743f3a 100644 --- a/src/libraries/System.Console/ref/System.Console.cs +++ b/src/libraries/System.Console/ref/System.Console.cs @@ -69,10 +69,10 @@ public static partial class Console [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static bool TreatControlCAsInput { get { throw null; } set { } } - public static int WindowHeight { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows"), System.Runtime.Versioning.SupportedOSPlatformAttribute("linux")] set { } } + public static int WindowHeight { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows"), System.Runtime.Versioning.SupportedOSPlatformAttribute("linux"), System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd"), System.Runtime.Versioning.SupportedOSPlatformAttribute("osx")] set { } } public static int WindowLeft { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } public static int WindowTop { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } - public static int WindowWidth { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows"), System.Runtime.Versioning.SupportedOSPlatformAttribute("linux")] set { } } + public static int WindowWidth { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows"), System.Runtime.Versioning.SupportedOSPlatformAttribute("linux"), System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd"), System.Runtime.Versioning.SupportedOSPlatformAttribute("osx")] set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] @@ -149,6 +149,8 @@ public static void SetOut(System.IO.TextWriter newOut) { } public static void SetWindowPosition(int left, int top) { } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] [System.Runtime.Versioning.SupportedOSPlatformAttribute("linux")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd")] + [System.Runtime.Versioning.SupportedOSPlatformAttribute("osx")] public static void SetWindowSize(int width, int height) { } public static void Write(bool value) { } public static void Write(char value) { } diff --git a/src/libraries/System.Console/src/System/Console.cs b/src/libraries/System.Console/src/System/Console.cs index c22d79cb441b8..698867d2f38dd 100644 --- a/src/libraries/System.Console/src/System/Console.cs +++ b/src/libraries/System.Console/src/System/Console.cs @@ -401,6 +401,8 @@ public static int WindowWidth get { return ConsolePal.WindowWidth; } [SupportedOSPlatform("windows")] [SupportedOSPlatform("linux")] + [SupportedOSPlatform("freebsd")] + [SupportedOSPlatform("osx")] set { if (Console.IsOutputRedirected) @@ -424,6 +426,8 @@ public static int WindowHeight get { return ConsolePal.WindowHeight; } [SupportedOSPlatform("windows")] [SupportedOSPlatform("linux")] + [SupportedOSPlatform("freebsd")] + [SupportedOSPlatform("osx")] set { if (Console.IsOutputRedirected) @@ -446,6 +450,8 @@ public static void SetWindowPosition(int left, int top) [SupportedOSPlatform("windows")] [SupportedOSPlatform("linux")] + [SupportedOSPlatform("freebsd")] + [SupportedOSPlatform("osx")] public static void SetWindowSize(int width, int height) { if (Console.IsOutputRedirected) From 3379de1b7c023349c8c893a499340ef458ae08af Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Fri, 30 Sep 2022 14:21:56 +0900 Subject: [PATCH 06/12] Enable SetWindowSize_GetWindowSize_ReturnsExpected --- src/libraries/System.Console/tests/WindowAndCursorProps.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Console/tests/WindowAndCursorProps.cs b/src/libraries/System.Console/tests/WindowAndCursorProps.cs index 82e7ad470be5d..10d0371d9a903 100644 --- a/src/libraries/System.Console/tests/WindowAndCursorProps.cs +++ b/src/libraries/System.Console/tests/WindowAndCursorProps.cs @@ -559,7 +559,7 @@ public void SetWindowPosition_Unix_ThrowsPlatformNotSupportedException() Assert.Throws(() => Console.SetWindowPosition(50, 50)); } - [PlatformSpecific(TestPlatforms.Windows)] + [PlatformSpecific((TestPlatforms.Windows) | (TestPlatforms.AnyUnix & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.MacCatalyst & ~TestPlatforms.tvOS))] [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] public void SetWindowSize_GetWindowSize_ReturnsExpected() { From ee31937ab4b32a4838d8d670c23326cc5ee0e5bd Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Fri, 28 Oct 2022 16:09:04 +0200 Subject: [PATCH 07/12] add manual test --- .../tests/ManualTests/ManualTests.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/libraries/System.Console/tests/ManualTests/ManualTests.cs b/src/libraries/System.Console/tests/ManualTests/ManualTests.cs index ce69b2fad7d50..ee5aaadfdcad1 100644 --- a/src/libraries/System.Console/tests/ManualTests/ManualTests.cs +++ b/src/libraries/System.Console/tests/ManualTests/ManualTests.cs @@ -5,7 +5,9 @@ using System.Diagnostics; using System.Threading.Tasks; using System.IO; +using System.Runtime.InteropServices; using System.Text; +using System.Threading; using Xunit; namespace System @@ -321,6 +323,44 @@ public static void EncodingTest() AssertUserExpectedResults("Pi and Sigma or question marks"); } + [ConditionalFact(nameof(ManualTestsEnabled))] + [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on Browser, iOS, MacCatalyst, or tvOS.")] + public static void ResizeTest() + { + bool wasResized = false; + + using (ManualResetEvent manualResetEvent = new(false)) + using (PosixSignalRegistration.Create(PosixSignal.SIGWINCH, + ctx => + { + wasResized = true; + Assert.Equal(PosixSignal.SIGWINCH, ctx.Signal); + manualResetEvent.Set(); + })) + { + int widthBefore = Console.WindowWidth; + int heightBefore = Console.WindowHeight; + + Assert.False(wasResized); + + Console.SetWindowSize(widthBefore / 2, heightBefore / 2); + + Assert.True(manualResetEvent.WaitOne(TimeSpan.FromMilliseconds(50))); + Assert.True(wasResized); + Assert.Equal(widthBefore / 2, Console.WindowWidth ); + Assert.Equal(heightBefore / 2, Console.WindowHeight ); + + try + { + AssertUserExpectedResults("terminal window getting two times smaller?"); + } + finally + { + Console.SetWindowSize(widthBefore, heightBefore); + } + } + } + private static void AssertUserExpectedResults(string expected) { Console.Write($"Did you see {expected}? [y/n] "); From 4591a932b05c1200c7336a5de6308d0310a2fd6f Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Tue, 1 Nov 2022 08:30:03 +0900 Subject: [PATCH 08/12] Remove note in ArgumentOutOfRangeException Co-authored-by: Dan Moseley --- .../src/System/ArgumentOutOfRangeException.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/ArgumentOutOfRangeException.cs b/src/libraries/System.Private.CoreLib/src/System/ArgumentOutOfRangeException.cs index b9ac1424bb9de..65563b20d495b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/ArgumentOutOfRangeException.cs +++ b/src/libraries/System.Private.CoreLib/src/System/ArgumentOutOfRangeException.cs @@ -48,9 +48,6 @@ public ArgumentOutOfRangeException(string? message, Exception? innerException) HResult = HResults.COR_E_ARGUMENTOUTOFRANGE; } - // We will not use this in the classlibs, but we'll provide it for - // anyone that's really interested so they don't have to stick a bunch - // of printf's in their code. public ArgumentOutOfRangeException(string? paramName, object? actualValue, string? message) : base(message, paramName) { @@ -87,9 +84,6 @@ public override string Message } // Gets the value of the argument that caused the exception. - // Note - we don't set this anywhere in the class libraries in - // version 1, but it might come in handy for other developers who - // want to avoid sticking printf's in their code. public virtual object? ActualValue => _actualValue; } } From e315d16aae366e45b9a416664ed54b2f5c36840f Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Thu, 3 Nov 2022 06:13:10 +0900 Subject: [PATCH 09/12] Update src/libraries/System.Console/tests/ManualTests/ManualTests.cs Co-authored-by: Adam Sitnik --- .../System.Console/tests/ManualTests/ManualTests.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/libraries/System.Console/tests/ManualTests/ManualTests.cs b/src/libraries/System.Console/tests/ManualTests/ManualTests.cs index ee5aaadfdcad1..a4eb87d0f8b81 100644 --- a/src/libraries/System.Console/tests/ManualTests/ManualTests.cs +++ b/src/libraries/System.Console/tests/ManualTests/ManualTests.cs @@ -350,14 +350,7 @@ public static void ResizeTest() Assert.Equal(widthBefore / 2, Console.WindowWidth ); Assert.Equal(heightBefore / 2, Console.WindowHeight ); - try - { - AssertUserExpectedResults("terminal window getting two times smaller?"); - } - finally - { - Console.SetWindowSize(widthBefore, heightBefore); - } + Console.SetWindowSize(widthBefore, heightBefore); } } From b61691411f74eb89d43055cbaa3e1cd6d87e380a Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Fri, 4 Nov 2022 06:22:46 +0900 Subject: [PATCH 10/12] Apply suggestions from code review Co-authored-by: Stephen Toub --- src/libraries/System.Console/src/System/Console.cs | 7 +++++++ .../System.Console/src/System/ConsolePal.Unix.cs | 11 +++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Console/src/System/Console.cs b/src/libraries/System.Console/src/System/Console.cs index 698867d2f38dd..67a6c6103a626 100644 --- a/src/libraries/System.Console/src/System/Console.cs +++ b/src/libraries/System.Console/src/System/Console.cs @@ -409,10 +409,12 @@ public static int WindowWidth { throw new IOException(SR.InvalidOperation_SetWindowSize); } + if (value <= 0) { throw new ArgumentOutOfRangeException(nameof(value), value, SR.ArgumentOutOfRange_NeedPosNum); } + ConsolePal.WindowWidth = value; } } @@ -434,10 +436,12 @@ public static int WindowHeight { throw new IOException(SR.InvalidOperation_SetWindowSize); } + if (value <= 0) { throw new ArgumentOutOfRangeException(nameof(value), value, SR.ArgumentOutOfRange_NeedPosNum); } + ConsolePal.WindowHeight = value; } } @@ -458,14 +462,17 @@ public static void SetWindowSize(int width, int height) { throw new IOException(SR.InvalidOperation_SetWindowSize); } + if (width <= 0) { throw new ArgumentOutOfRangeException(nameof(width), width, SR.ArgumentOutOfRange_NeedPosNum); } + if (height <= 0) { throw new ArgumentOutOfRangeException(nameof(height), height, SR.ArgumentOutOfRange_NeedPosNum); } + ConsolePal.SetWindowSize(width, height); } diff --git a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs index 7dd2a44679aa1..428fcbab0e701 100644 --- a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs +++ b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs @@ -405,14 +405,9 @@ public static void SetWindowSize(int width, int height) else { Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); - if (errorInfo.Error == Interop.Error.ENOTSUP) - { - throw new PlatformNotSupportedException(); - } - else - { - throw Interop.GetIOException(errorInfo); - } + throw errorInfo.Error == Interop.Error.ENOTSUP ? + new PlatformNotSupportedException() : + Interop.GetIOException(errorInfo); } } } From 3cff6cbea2675077e317e92cd0c7d2c04f043790 Mon Sep 17 00:00:00 2001 From: Hyungju Lee Date: Fri, 4 Nov 2022 06:42:22 +0900 Subject: [PATCH 11/12] Cleanup SupportOSPlatfromAttributes --- .../System.Console/ref/System.Console.cs | 20 ++++++++---- .../System.Console/src/System/Console.cs | 32 +++++++------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/libraries/System.Console/ref/System.Console.cs b/src/libraries/System.Console/ref/System.Console.cs index 6d62134743f3a..dfcce82fb96b8 100644 --- a/src/libraries/System.Console/ref/System.Console.cs +++ b/src/libraries/System.Console/ref/System.Console.cs @@ -69,10 +69,18 @@ public static partial class Console [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static bool TreatControlCAsInput { get { throw null; } set { } } - public static int WindowHeight { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows"), System.Runtime.Versioning.SupportedOSPlatformAttribute("linux"), System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd"), System.Runtime.Versioning.SupportedOSPlatformAttribute("osx")] set { } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + public static int WindowHeight { get { throw null; } set { } } public static int WindowLeft { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } public static int WindowTop { get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] set { } } - public static int WindowWidth { [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios"), System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] get { throw null; } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows"), System.Runtime.Versioning.SupportedOSPlatformAttribute("linux"), System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd"), System.Runtime.Versioning.SupportedOSPlatformAttribute("osx")] set { } } + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] + public static int WindowWidth { get { throw null; } set { } } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] @@ -147,10 +155,10 @@ public static void SetIn(System.IO.TextReader newIn) { } public static void SetOut(System.IO.TextWriter newOut) { } [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] public static void SetWindowPosition(int left, int top) { } - [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] - [System.Runtime.Versioning.SupportedOSPlatformAttribute("linux")] - [System.Runtime.Versioning.SupportedOSPlatformAttribute("freebsd")] - [System.Runtime.Versioning.SupportedOSPlatformAttribute("osx")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("android")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")] + [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] public static void SetWindowSize(int width, int height) { } public static void Write(bool value) { } public static void Write(char value) { } diff --git a/src/libraries/System.Console/src/System/Console.cs b/src/libraries/System.Console/src/System/Console.cs index 67a6c6103a626..3f86082591046 100644 --- a/src/libraries/System.Console/src/System/Console.cs +++ b/src/libraries/System.Console/src/System/Console.cs @@ -392,17 +392,13 @@ public static int WindowTop set { ConsolePal.WindowTop = value; } } + [UnsupportedOSPlatform("android")] + [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static int WindowWidth { - [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] - [UnsupportedOSPlatform("ios")] - [UnsupportedOSPlatform("tvos")] get { return ConsolePal.WindowWidth; } - [SupportedOSPlatform("windows")] - [SupportedOSPlatform("linux")] - [SupportedOSPlatform("freebsd")] - [SupportedOSPlatform("osx")] set { if (Console.IsOutputRedirected) @@ -419,17 +415,13 @@ public static int WindowWidth } } + [UnsupportedOSPlatform("android")] + [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static int WindowHeight { - [UnsupportedOSPlatform("android")] - [UnsupportedOSPlatform("browser")] - [UnsupportedOSPlatform("ios")] - [UnsupportedOSPlatform("tvos")] get { return ConsolePal.WindowHeight; } - [SupportedOSPlatform("windows")] - [SupportedOSPlatform("linux")] - [SupportedOSPlatform("freebsd")] - [SupportedOSPlatform("osx")] set { if (Console.IsOutputRedirected) @@ -452,10 +444,10 @@ public static void SetWindowPosition(int left, int top) ConsolePal.SetWindowPosition(left, top); } - [SupportedOSPlatform("windows")] - [SupportedOSPlatform("linux")] - [SupportedOSPlatform("freebsd")] - [SupportedOSPlatform("osx")] + [UnsupportedOSPlatform("android")] + [UnsupportedOSPlatform("browser")] + [UnsupportedOSPlatform("ios")] + [UnsupportedOSPlatform("tvos")] public static void SetWindowSize(int width, int height) { if (Console.IsOutputRedirected) From e6413004228d0b3e40fde973c6750fab53c393fc Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Fri, 4 Nov 2022 16:59:30 +0100 Subject: [PATCH 12/12] Update APICompat annotations --- ...iCompatBaseline.NetCoreAppLatestStable.xml | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/src/libraries/apicompat/ApiCompatBaseline.NetCoreAppLatestStable.xml b/src/libraries/apicompat/ApiCompatBaseline.NetCoreAppLatestStable.xml index 21c4764e4c023..b749cf0613b55 100644 --- a/src/libraries/apicompat/ApiCompatBaseline.NetCoreAppLatestStable.xml +++ b/src/libraries/apicompat/ApiCompatBaseline.NetCoreAppLatestStable.xml @@ -24,6 +24,36 @@ net6.0/mscorlib.dll net7.0/mscorlib.dll + + CP0014 + M:System.Console.get_WindowHeight:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] + net6.0/mscorlib.dll + net7.0/mscorlib.dll + + + CP0014 + M:System.Console.get_WindowWidth:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] + net6.0/mscorlib.dll + net7.0/mscorlib.dll + + + CP0014 + M:System.Console.set_WindowHeight(System.Int32):[T:System.Runtime.Versioning.SupportedOSPlatformAttribute] + net6.0/mscorlib.dll + net7.0/mscorlib.dll + + + CP0014 + M:System.Console.set_WindowWidth(System.Int32):[T:System.Runtime.Versioning.SupportedOSPlatformAttribute] + net6.0/mscorlib.dll + net7.0/mscorlib.dll + + + CP0014 + M:System.Console.SetWindowSize(System.Int32,System.Int32):[T:System.Runtime.Versioning.SupportedOSPlatformAttribute] + net6.0/mscorlib.dll + net7.0/mscorlib.dll + CP0014 M:System.Security.Cryptography.RandomNumberGenerator.Create(System.String):[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] @@ -216,6 +246,36 @@ net6.0/netstandard.dll net7.0/netstandard.dll + + CP0014 + M:System.Console.get_WindowHeight:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] + net6.0/netstandard.dll + net7.0/netstandard.dll + + + CP0014 + M:System.Console.get_WindowWidth:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] + net6.0/netstandard.dll + net7.0/netstandard.dll + + + CP0014 + M:System.Console.set_WindowHeight(System.Int32):[T:System.Runtime.Versioning.SupportedOSPlatformAttribute] + net6.0/netstandard.dll + net7.0/netstandard.dll + + + CP0014 + M:System.Console.set_WindowWidth(System.Int32):[T:System.Runtime.Versioning.SupportedOSPlatformAttribute] + net6.0/netstandard.dll + net7.0/netstandard.dll + + + CP0014 + M:System.Console.SetWindowSize(System.Int32,System.Int32):[T:System.Runtime.Versioning.SupportedOSPlatformAttribute] + net6.0/netstandard.dll + net7.0/netstandard.dll + CP0014 M:System.Linq.EnumerableQuery`1.#ctor(System.Collections.Generic.IEnumerable{`0}):[T:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute] @@ -450,6 +510,36 @@ net6.0/netstandard.dll net7.0/netstandard.dll + + CP0014 + M:System.Console.get_WindowHeight:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] + net6.0/System.Console.dll + net7.0/System.Console.dll + + + CP0014 + M:System.Console.get_WindowWidth:[T:System.Runtime.Versioning.UnsupportedOSPlatformAttribute] + net6.0/System.Console.dll + net7.0/System.Console.dll + + + CP0014 + M:System.Console.set_WindowHeight(System.Int32):[T:System.Runtime.Versioning.SupportedOSPlatformAttribute] + net6.0/System.Console.dll + net7.0/System.Console.dll + + + CP0014 + M:System.Console.set_WindowWidth(System.Int32):[T:System.Runtime.Versioning.SupportedOSPlatformAttribute] + net6.0/System.Console.dll + net7.0/System.Console.dll + + + CP0014 + M:System.Console.SetWindowSize(System.Int32,System.Int32):[T:System.Runtime.Versioning.SupportedOSPlatformAttribute] + net6.0/System.Console.dll + net7.0/System.Console.dll + CP0014 M:System.Linq.EnumerableQuery`1.#ctor(System.Collections.Generic.IEnumerable{`0}):[T:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute]