From 85b8402448f9004825abee306dff7f9232c0dc14 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Mar 2026 05:51:29 +0000 Subject: [PATCH 1/2] Initial plan From 866f32cba23f17fbe699ed4d092960c3b69ee246 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Mar 2026 06:30:34 +0000 Subject: [PATCH 2/2] Changes before error encountered Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c6b2ec4b-f010-4dc2-98e3-9c2368ef485f Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com> --- src/libraries/System.Console/tests/Color.cs | 44 +++++++++++---------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/libraries/System.Console/tests/Color.cs b/src/libraries/System.Console/tests/Color.cs index d4a14d490bad6c..6f3fbb80957373 100644 --- a/src/libraries/System.Console/tests/Color.cs +++ b/src/libraries/System.Console/tests/Color.cs @@ -51,30 +51,34 @@ public static void BackgroundColor_Throws_PlatformNotSupportedException() Assert.Throws(() => Console.BackgroundColor = ConsoleColor.Red); } - [Fact] + [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on Browser, iOS, MacCatalyst, or tvOS.")] public static void RedirectedOutputDoesNotUseAnsiSequences() { - // Make sure that redirecting to a memory stream causes Console not to write out the ANSI sequences - - Helpers.RunInRedirectedOutput((data) => + // Make sure that redirecting to a memory stream causes Console not to write out the ANSI sequences. + // Run in a remote process to isolate from the test runner's background output thread, which may + // write diagnostic messages to Console.Out and pollute the redirected MemoryStream. + RemoteExecutor.Invoke(static () => { - Console.Write('1'); - Console.ForegroundColor = ConsoleColor.Blue; - Console.Write('2'); - Console.BackgroundColor = ConsoleColor.Red; - Console.Write('3'); - Console.ResetColor(); - Console.Write('4'); - - string output = Encoding.UTF8.GetString(data.ToArray()); - - // Use char-level check rather than string search: culture-sensitive string - // comparison treats control characters like ESC (\x1B) as ignorable, so - // Assert.DoesNotContain(Esc.ToString(), ...) would always pass. - Assert.Equal(0, output.Count(c => c == Esc)); - Assert.Equal("1234", output); - }); + Helpers.RunInRedirectedOutput((data) => + { + Console.Write('1'); + Console.ForegroundColor = ConsoleColor.Blue; + Console.Write('2'); + Console.BackgroundColor = ConsoleColor.Red; + Console.Write('3'); + Console.ResetColor(); + Console.Write('4'); + + string output = Encoding.UTF8.GetString(data.ToArray()); + + // Use char-level check rather than string search: culture-sensitive string + // comparison treats control characters like ESC (\x1B) as ignorable, so + // Assert.DoesNotContain(Esc.ToString(), ...) would always pass. + Assert.Equal(0, output.Count(c => c == Esc)); + Assert.Equal("1234", output); + }); + }).Dispose(); } public static bool TermIsSetAndRemoteExecutorIsSupported