From 83a3a00b00959f89f6a3dc764fd863c8d5bce2f3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 Aug 2025 15:30:28 +0000 Subject: [PATCH 1/5] Initial plan From 29a1f8482679bfd94c9e497254057277b4e8dd23 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 Aug 2025 15:55:14 +0000 Subject: [PATCH 2/5] Fix first-run experience to output to stderr instead of stdout Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- Program.cs | 2 ++ sdk.csproj | 10 +++++++ src/Cli/dotnet/Program.cs | 2 +- ...atTheUserIsRunningDotNetForTheFirstTime.cs | 26 ++++++++++++++++++- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 Program.cs create mode 100644 sdk.csproj diff --git a/Program.cs b/Program.cs new file mode 100644 index 000000000000..3751555cbd32 --- /dev/null +++ b/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/sdk.csproj b/sdk.csproj new file mode 100644 index 000000000000..ed9781c223ab --- /dev/null +++ b/sdk.csproj @@ -0,0 +1,10 @@ + + + + Exe + net10.0 + enable + enable + + + diff --git a/src/Cli/dotnet/Program.cs b/src/Cli/dotnet/Program.cs index 7762b77e8c09..e62af96e193a 100644 --- a/src/Cli/dotnet/Program.cs +++ b/src/Cli/dotnet/Program.cs @@ -389,7 +389,7 @@ private static void ConfigureDotNetForFirstTimeUse( var environmentPath = EnvironmentPathFactory.CreateEnvironmentPath(isDotnetBeingInvokedFromNativeInstaller, environmentProvider); _ = new DotNetCommandFactory(alwaysRunOutOfProc: true); var aspnetCertificateGenerator = new AspNetCoreCertificateGenerator(); - var reporter = Reporter.Output; + var reporter = Reporter.Error; var dotnetConfigurer = new DotnetFirstTimeUseConfigurer( firstTimeUseNoticeSentinel, aspNetCertificateSentinel, diff --git a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs index 77abe37fecfc..46b18336b5f1 100644 --- a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs +++ b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs @@ -118,6 +118,30 @@ public void ItShowsTheAppropriateMessageToTheUser() .And.NotContain("Restore completed in"); } + [WindowsOnlyFact] + public void FirstRunExperienceMessagesShouldGoToStdErr() + { + // This test ensures that first-run experience messages go to stderr, + // not stdout, to avoid interfering with completion commands and other + // tools that parse stdout. See: https://github.com/dotnet/sdk/issues/50444 + var expectedVersion = GetDotnetVersion(); + + // StdErr should contain first-run messages + _fixture.FirstDotnetVerbUseCommandResult.StdErr + .Should() + .ContainVisuallySameFragment(string.Format( + Configurer.LocalizableStrings.FirstTimeMessageWelcome, + DotnetFirstTimeUseConfigurer.ParseDotNetVersion(expectedVersion), + expectedVersion)) + .And.ContainVisuallySameFragment(Configurer.LocalizableStrings.FirstTimeMessageMoreInformation); + + // StdOut should NOT contain first-run messages (they should only be in stderr) + _fixture.FirstDotnetVerbUseCommandResult.StdOut + .Should() + .NotContain("Welcome to .NET") + .And.NotContain("Write your first app"); + } + [Fact] public void ItCreatesAFirstUseSentinelFileUnderTheDotDotNetFolder() { @@ -164,7 +188,7 @@ public void ItShowsTheTelemetryNoticeWhenInvokingACommandAfterInternalReportInst var expectedVersion = GetDotnetVersion(); - result.StdOut + result.StdErr .Should() .ContainVisuallySameFragment(string.Format( Configurer.LocalizableStrings.FirstTimeMessageWelcome, From ca59853c6ad9ebe601af8127e75c6343b16a924a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 23 Aug 2025 15:55:42 +0000 Subject: [PATCH 3/5] Remove unintended files from commit Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- Program.cs | 2 -- sdk.csproj | 10 ---------- 2 files changed, 12 deletions(-) delete mode 100644 Program.cs delete mode 100644 sdk.csproj diff --git a/Program.cs b/Program.cs deleted file mode 100644 index 3751555cbd32..000000000000 --- a/Program.cs +++ /dev/null @@ -1,2 +0,0 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); diff --git a/sdk.csproj b/sdk.csproj deleted file mode 100644 index ed9781c223ab..000000000000 --- a/sdk.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - Exe - net10.0 - enable - enable - - - From d4d5508a71d0389311b703ddf023b47157998d7b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 24 Aug 2025 14:06:01 +0000 Subject: [PATCH 4/5] Fix ItShowsTheAppropriateMessageToTheUser test to check stderr instead of stdout Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- .../GivenThatTheUserIsRunningDotNetForTheFirstTime.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs index 46b18336b5f1..a9087ba6713f 100644 --- a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs +++ b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs @@ -108,7 +108,7 @@ public void ItShowsTheAppropriateMessageToTheUser() { var expectedVersion = GetDotnetVersion(); - _fixture.FirstDotnetVerbUseCommandResult.StdOut + _fixture.FirstDotnetVerbUseCommandResult.StdErr .Should() .ContainVisuallySameFragment(string.Format( Configurer.LocalizableStrings.FirstTimeMessageWelcome, From fcab33f2ac53b68fa11433b092299dc34fa25320 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 24 Aug 2025 14:20:53 +0000 Subject: [PATCH 5/5] Change WindowsOnlyFact to Fact for ItShowsTheAppropriateMessageToTheUser test and update copilot-instructions with test running guidance Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- .github/copilot-instructions.md | 7 +++++++ .../GivenThatTheUserIsRunningDotNetForTheFirstTime.cs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index beabe34a69c9..56eddb899a16 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -6,6 +6,13 @@ Coding Style and Changes: Testing: - Large changes should always include test changes. - The Skip parameter of the Fact attribute to point to the specific issue link. +- To run tests in this repo: + - Use the repo-local dotnet instance: `./.dotnet/dotnet` + - For MSTest-style projects: `dotnet test path/to/project.csproj --filter "FullyQualifiedName~TestName"` + - For XUnit test assemblies: `dotnet exec artifacts/bin/redist/Debug/TestAssembly.dll -method "*TestMethodName*"` + - Examples: + - `dotnet test test/dotnet.Tests/dotnet.Tests.csproj --filter "Name~ItShowsTheAppropriateMessageToTheUser"` + - `dotnet exec artifacts/bin/redist/Debug/dotnet.Tests.dll -method "*ItShowsTheAppropriateMessageToTheUser*"` Output Considerations: - When considering how output should look, solicit advice from baronfel. diff --git a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs index a9087ba6713f..b67afbf7dacd 100644 --- a/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs +++ b/test/dotnet.Tests/GivenThatTheUserIsRunningDotNetForTheFirstTime.cs @@ -103,7 +103,7 @@ public void UsingDotnetForTheFirstTimeWithNonVerbsDoesNotPrintEula() .StartWith(firstTimeNonVerbUseMessage); } - [WindowsOnlyFact] + [Fact] public void ItShowsTheAppropriateMessageToTheUser() {