Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 12, 2025

  • Explore repository structure and understand the codebase
  • Identify completion-related commands (complete and completions)
  • Build the SDK in Debug configuration
  • Reproduce the issue - confirmed first-run messages appear in stdout with completion commands
  • Understand the root cause in Program.cs ConfigureDotNetForFirstTimeUse method
  • Identify completion commands to exclude from first-run experience
  • Implement minimal fix to skip first-run for completion commands
  • Test and verify completion commands work correctly without first-run messages
  • Test that regular commands still show first-run experience
  • Add tests to validate the fix
  • Verify the fix works with the redistributable dotnet executable

Issue: When users run dotnet completions script <shell> or dotnet complete commands to generate shell completion scripts, the first-run experience messages are printed to stdout, corrupting the shell completion scripts.

Root cause: The ConfigureDotNetForFirstTimeUse method in Program.cs runs for all commands and prints welcome messages to stdout via the DotnetFirstTimeUseConfigurer.

Solution: Added an IsCompletionCommand() method that identifies completion-related commands (complete and completions) and skips the first-run experience for them by setting skipFirstTimeUseCheck=true.

Testing:

  • dotnet completions script bash - no first-run messages, clean script output
  • dotnet complete "dotnet completions " - no first-run messages, clean completion output
  • dotnet build --help - first-run messages appear correctly for regular commands
  • dotnet --version - continues to work without first-run (existing behavior)

The fix is minimal and surgical, affecting only the specific commands that generate completion scripts while preserving the first-run experience for all other commands.

Fixes #50065.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Skip first-run experience for 'complete' and 'completions' commands to prevent
welcome messages from corrupting shell completion scripts when users run
`dotnet completions script <shell>` or similar commands.

The fix adds an IsCompletionCommand() method that identifies completion-related
commands and sets skipFirstTimeUseCheck=true for them, preventing first-run
configuration from printing to stdout.

Tested with both completion commands - no first-run messages appear.
Regular commands like 'build' still show first-run experience correctly.

Co-authored-by: marcpopMSFT <[email protected]>
@baronfel
Copy link
Member

closing in favor of #50454

@baronfel baronfel closed this Aug 24, 2025
@MichaelSimons MichaelSimons deleted the copilot/fix-50065 branch September 29, 2025 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotnet first-run text negatively impacts completion script generation

3 participants